<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create new columns dynamically in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375728#M138084</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am pretty new to talend and I had an issue where I stuck. We receive CSV files from a server and we just load them into Oracle database. But I am trying to develop a job where it creates a new column into the table if it not exist.&lt;/P&gt;&lt;P&gt;For example: If I received a file with 30 columns for the first time and then I loaded into database by creating it. In the next run if I receive a file with 40 columns, then I want to create that extra 10 columns into the table with out dropping and creating the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone of let me know if this is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:37:28 GMT</pubDate>
    <dc:creator>Karthik_Kommarraju</dc:creator>
    <dc:date>2024-11-16T01:37:28Z</dc:date>
    <item>
      <title>Create new columns dynamically</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375728#M138084</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am pretty new to talend and I had an issue where I stuck. We receive CSV files from a server and we just load them into Oracle database. But I am trying to develop a job where it creates a new column into the table if it not exist.&lt;/P&gt;&lt;P&gt;For example: If I received a file with 30 columns for the first time and then I loaded into database by creating it. In the next run if I receive a file with 40 columns, then I want to create that extra 10 columns into the table with out dropping and creating the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone of let me know if this is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:37:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375728#M138084</guid>
      <dc:creator>Karthik_Kommarraju</dc:creator>
      <dc:date>2024-11-16T01:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create new columns dynamically</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375729#M138085</link>
      <description>&lt;P&gt;Curious why you'd choose a relational db system to house dynamically changing schema. Sounds better suited for some NoSQL variant. This is definitely possible, but it seems like a lot of overhead. You'll have to get the column names from the db + the new file, compare them and find any differences, alter the table to add the new columns then load the new file after committing. Try looking into &lt;A href="https://help.talend.com/reader/9bBURCEt_t~lUHE3DeE2LA/UEnIUKIOXBR8WRRYRvwikA" alt="https://help.talend.com/reader/9bBURCEt_t~lUHE3DeE2LA/UEnIUKIOXBR8WRRYRvwikA" target="_blank"&gt;dynamic schema&lt;/A&gt;. I've done something similar before, but it wasn't pretty.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 13:58:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375729#M138085</guid>
      <dc:creator>evansdar</dc:creator>
      <dc:date>2020-08-21T13:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create new columns dynamically</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375730#M138086</link>
      <description>&lt;P&gt;I have only one such kind of file and I want that data to connect to other tables in oracle. So I don't want to change the db for this. As you said it is lot of overhead to change columns dynamically. I am trying to find out best option available. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 14:41:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375730#M138086</guid>
      <dc:creator>Karthik_Kommarraju</dc:creator>
      <dc:date>2020-08-21T14:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create new columns dynamically</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375731#M138087</link>
      <description>&lt;P&gt;Yes is possible, although wouldnt recommend,  but I get it. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your idea... more or less&lt;/P&gt;&lt;P&gt;Some conceptual steps to prepare/before actualy creating columns:&lt;/P&gt;&lt;P&gt;1 - Read from sys tables the columns of your table. &lt;/P&gt;&lt;P&gt;2A - from csv-file read only first line (header.) as a string, headerString.split it  by your seperator. So you can loop through this array. Or keep it as a string to use in a where statement.&lt;/P&gt;&lt;P&gt;2B - Normalize your headerString so columns are in correct formatted column names. &lt;/P&gt;&lt;P&gt;3 - User your headerString in a query to get the delta/not existing columns, ALL_TAB_COLUMNS in Oracle.&lt;/P&gt;&lt;P&gt;4 - result of step 3,  tricky part is datatype, first check number (int, decimal or float),  string is XML or JSON if not normal string ,  do some custom sjizzle here.&lt;/P&gt;&lt;P&gt;5 - generate your ALTER TABLE ADD COLUMN statement. &lt;/P&gt;&lt;P&gt;6 - generate your INSERT statement.  &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively &lt;/P&gt;&lt;P&gt;1 - Read every file with the same columnschema into the same table based on fingerprint (generate a column header hash to identify) and use it as tablename.&lt;/P&gt;&lt;P&gt;2 - Use the ALL_TAB_COLUMNS and generate a SQL query or VIEW to MERGE, UNION, APPEND assuming the filesizes are not to big.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Dont change structure&lt;/LI&gt;&lt;LI&gt;Convert your file into a json or xml in a blob&lt;/LI&gt;&lt;LI&gt;Store it with a header fingerprint and all columnnames as string/list, and also the filename. &lt;/LI&gt;&lt;LI&gt;Append each file to this table, pretty straight forward &lt;/LI&gt;&lt;LI&gt;write sql to handle json/xml with different columnames/filtetypes. &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have fun.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 22:23:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-new-columns-dynamically/m-p/2375731#M138087</guid>
      <dc:creator>Jesperrekuh</dc:creator>
      <dc:date>2020-08-22T22:23:38Z</dc:date>
    </item>
  </channel>
</rss>

