0

there is a way to copy data from table to a file with pscyopg2 copy_to or copy_expert. Is there any way to copy table structure to a file so that I can create the same table during tests?

It should be done programatically in script, because there are no migrations and from time to time need to regenerate tables structures to file to have valid schema in tests

johanson
  • 147
  • 1
  • 7
  • @Gabip nope, I'd like to implement it with psycopg2 or at least in python. I can still call pgdump from python but it requires linux package to be installed – johanson Jan 28 '21 at 21:53
  • No. If you want to do that you would need to create/change tables through scripts and then use those scripts(files). – Adrian Klaver Jan 29 '21 at 00:50

0 Answers0