etlalchemy
etlalchemy copied to clipboard
Upsert() should function on tables w/o a PK
Hi is there any method to remove only tables while upserting
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Could you be a more specific? I'm not sure exactly what you mean...
Hi , when I am making drop_database=false each time the data is appending to the table thus making duplicates records
Does the table with the duplicate records have a primary key? I believe we use the primary key of the table to determine whether a row should be updated or inserted.
what if it does not contain primary keys?
There should be 2 fallback options if no primary keys are present on the table (in order):
- We gather all FKs, and use them as a "composite primary key" to
upsert()
on. This will be a common case when dealing with association tables (in many-to-many relations). - We specify the columns that make up the "composite primary key", as a part of the config, for each table that does not have a primary key.