Skip to content Skip to sidebar Skip to footer

Create A Sqlalchemy Engine Using An Existing Psycopg2 Connection Pool

I'm adding a new ORM class using sqlalchemy's declarative mapping system. My codebase has an existing psycopg2 connection pool, which I want to reuse - I don't want code using my o

Solution 1:

You can use a custom connection function:

create_engine('postgresql+psycopg2://', creator=POOL.getconn)

Post a Comment for "Create A Sqlalchemy Engine Using An Existing Psycopg2 Connection Pool"