Search Postgresql Archives

PostgreSQL DB in prod, test, debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This project uses Python 3.12, Flask, psycopg3 and PostgreSQL 15.

This is probably a stupid question so I apologies in advance.

I'm building a website using PostgreSQL and since I've just been doing some dev work on it I've just manually played around with the database if I needed new tables or functions for example but I want to start doing automated testing and need to import a clean snapshot of the database with no data and then use the automated tests to test if things work with the tests.

What I think is the best way to do this is to do a pg_dump of the database (using the --schema-only flag) and then load it into a test only database that gets created at the start of the unit tests and destroyed at the end. The automated tests will insert, update, delete and select data to test if it all still works.

My main question is does this sound OK? And if so is there a nice way to automate the dump / restore in Python?

Simon.

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux