Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

CSV to SQlite db

I want to insert data from CSV file to Sqlite table with different table name on the basis of value that I get from CSV file. My file has 4 columns I want to use 2 of them to populate database. 

1. MD5(32 byte)  --> I want to split this into two and create tableName = first 3 byte and hash column remaining 29 byte

 

2. name --> store this as it is from csv.

 

 

Please help how can achieve this functionality, which is how to get value from csv attribute and use it as table name and remaining string to be passed as column value.

Labels (3)
5 Replies
akumar2301
Specialist II
Specialist II

 

 

Input —>

tjavarow ( split md5 column in two - tablename and hashbyte) —>

tflowtoiterate(  each column value becomes part of  globalMap) —>

titeratetoflow ( map globalMap variable created before with columns to be mapped in table - hashbyte,name) --> tdboutput ( for table name ,use  globalMap variable created by tflowtoiterate)

 

0683p000009M2Z2.jpg

Anonymous
Not applicable
Author

Thank you Abhishek for the quick response. I was able to implement the solution as suggested by you. I dynamically got the tablename from global variable by using tflowtoiterate & titeratetoflow. However using this I am able to insert data in only 1 table. I want to insert data in multiple tables.

 

I will again explain my requirement.

I have 1 csv file example having 3 columns

File - Employee

 

Dept, EmpName, Sal

Finance, ABC, 4000

Admin, PQR, 3000

Tech, STU, 5000

Finance, KLJ, 3500

Tech, RTR, 6000

Finance, HJH, 4000

Admin, NBM, 8000

 

I want to populate data of these CSV in 1 SQlite database and multiple tables as per the department. From the above csv file I have to dynamically create 3 tables (Finance, Admin and Tech) and insert row in each of the tables dynamically as per the employee department

 

Output required

Table1 - Fin

 

Finance, ABC, 4000

Finance, KLJ, 3500

Finance, HJH, 4000

 

Table 2 - Adm

Admin, PQR, 3000

Admin, NBM, 8000

 

Table 3 - Tec

Tech, STU, 5000

Tech, RTR, 6000

akumar2301
Specialist II
Specialist II

instead of tIteratetoflow , can you try tFixedFlowInput and Assign GlobalMap Var similarly as you did for tIteratetoflow.

Anonymous
Not applicable
Author

Thanks again for responding quickly. I really appreciate your efforts.

 

The solution you suggested worked for me but now the performance is low, it is updating 4 rows/sec. Is there is a way to increase that ?

akumar2301
Specialist II
Specialist II

Instead of directly inserting in Databse , I would suggest to create separate temprory files( FileName as 3 char MD5 code).

 

then use tFileList , Load each file in tSqlLiteOutput (FileName w/o extn as output table name )