I am trying to generate columns in myql database using context variables in talend open studio. How can we generate context query accordingly to that. I have searched in google, there are some answers using tfileInput and then edit schema so you can add columns manually there, but I don't want to follow this oder. I am having tMysqlRow as input connected to my local DB and under query section of that how can I use context variables to generate columns in database. In this way I don't need to drop the table when I have to add a new column.
Asked
Active
Viewed 480 times
3
-
Talend is primarily an ETL tool. Creating tables is a byproduct of loading data. My advice is to ask a better question. But if you really want to do it with a context variable, then create your variable and enter an alter statement then "select 1" In MS SQL separate with a semicolon. Then in a SQLInput object, in the query section reference your context variable. SQLInput object requires a result set, therefore the select 1. I have tested it and it works, but I really see no purpose to doing it way and think you should reevaluate how you are using the tool. – E LaRoche Nov 11 '16 at 20:47
-
@ELaRoche probably you didn't understood the question exactly, I wanted to create a class body by using context variables in talend so that instead of creating sql tables manually I would just give my details in a file and when ever I run the job a table is created in workbench. Nevertheless I have solved it. Thanks – many Nov 12 '16 at 12:00
-
How do you accept new columns? As far as I know you'd have to alter the job every time a column changes. – tobi6 Nov 21 '16 at 12:18
-
@tobi6 I don't want to change a column once if I have a fixed table. I would create a subjob which is modular and reusable. For instance it acts like a class and creates as many objects needed. Once you have a modular job all you need to do is give the column names there and it creates a new table but not altering the old table. – many Nov 23 '16 at 09:51
-
I am very interested how you would provide dynamic column names for a modular job. As far as I know, Talend is not that flexible without custom Java. – tobi6 Nov 23 '16 at 12:03