Skip to content
Advertisement

DuckDB – efficiently insert pandas dataframe to table with sequence

Insertion with series works just fine:

How I can use the sequence with pandas dataframe?

I don’t want to iterate item by item. The goal is to efficiently insert 1000s of items from python to DB. I’m ok to change pandas to something else.

Advertisement

Answer

Can’t you have nextval(‘serial’) as part of your select query when reading the df?

e.g.,

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement