Reputation: 61
I'm new to DB/postgres SQL. Scenario: Need to load an csv file into postgres DB. This CSV data needs to loaded into multiple tables according DB schema. I'm looking for better design using python script.
My thought: 1. Load CSV file to intermediate table in postgres 2. Write a trigger on intermediate table to insert data into multiple tables on event of insert 3. Trigger includes truncate data at end
Any suggestions for better design/other ways without any ETL tools, and also any info on modules in Python 3.
Thanks.
Upvotes: 0
Views: 991
Reputation: 247575
Rather than using a trigger, use an explicit INSERT
or UPDATE
statement. That is probably faster, since it is not invoked per row.
Apart from that, your procedure is fine.
Upvotes: 1