Hi all, thought I would post this here since this community might find this 
useful.

I've created a simple python module which can be used to quickly spin up a 
temporary, disposable postgres server. The main purpose I envisioned for 
this was for writing tests.

https://pypi.org/project/pg-temp/

Basically, it works like this:
from pg_temp import TempDB
temp_db = TempDB(databases=['testdb'])
# you can connect to this database using temp_db's pg_socket_dir
connection = psycopg2.connect(host=temp_db.pg_socket_dir, database='testdb')

For many years since using sqlalchemy to abstract the database, I had 
fallen into the common trap of writing production code targeting postgres, 
and running unit tests against sqlite, which is a bad idea for many 
reasons. So I wrote pg-temp so that I'd be able to run unit tests against 
postgres as easily as I had been doing so against sqlite.

I've been working on it for a couple of years already, so I'd appreciate 
any feedback or opinions you, the sqlalchemy community, might have. Thanks

Uri

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/a5691243-5685-47ca-be35-78723060fe15n%40googlegroups.com.

Reply via email to