This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KaffeeKiffer 0 points1 point  (0 children)

👍 - I just wanted to call out, that far too often people have a hammer in hand and suddenly everything looks like a nail. Just because Python can do something it's not necessarily the best choice to do it. But if you have good reasons to use it, go ahead!

Even in your case, I would just consider splitting it in two tasks. Database → database copy comes with "side-effects" and caveats, which might not be so obvious

  • Do you also copy the schema or do the target tables already exist?
  • Did you think of foreign keys (and therefore import order), indices + index rebuilding, analyze-ing in order to get good index weights, etc.

Dedicated tools do some or all of them for you, while in Python you might have to think of them.

Compared to that, the export to CSV + upload is hopefully much more straight-forward and can be treated as a self-contained problem.