9 ms·
I concur - we load a fair amount of data into Postgres using Python and we've learned these lessons the hard way. We ended up feeding generators into execute_ba
by drej 7y ago
I concur - we load a fair amount of data into Postgres using Python and we've learned these lessons the hard way. We ended up feeding generators into execute_batch.
We don't use execute_values, because we want to generate dictionaries (since there are usually multiple generators along the way) and we don't use copy_from, because the cognitive overhead of data prep is just way too high for the benefit (for us! your mileage may vary).
Great stuff, I've already circulated it at work.
- C1sc0cat 7y agoFor old school CSV and Excel that requires any processing before inserting I Have found Perl with the Relevant Modules from CPAN for CSV and Excel is the best solution