2

Based on this great answer by zzzeek, I would like to use SQLAlchemy + PostgreSQL with gevent. My problem is that I don't know what is an up-to-date PostgreSQL driver for such scenario.

Before I always used psycopg2, as I found it to be extremely stable and reliable.

My problem is that if I understand right psycopg2 needs to be monkey-patched to work under gevent, right? And the only way to do it is to use psycogreen, a project whose latest PyPi release is from 2012, has not been updated since 2015 and doesn't support Python 3.

How do you use SQLAlchemy in a concurrent way today? Is it simply not possible?

Cœur
  • 37,241
  • 25
  • 195
  • 267
hyperknot
  • 13,454
  • 24
  • 98
  • 153
  • 3
    `psycogreen` works fine in Python 3. You can also just copy the [code](https://bitbucket.org/dvarrazzo/psycogreen/src/115d0627da1ac9ff48c0cb9287257cd35868cdf9/psycogreen/gevent.py) directly if you want -- there's nothing Python 2-specific in there. – univerio Aug 31 '17 at 18:28

1 Answers1

0

I posted my own psycopg2 gevent code. This sets up a pool so you can manage connections, uses gevent threading, and handles low latency connections well.

Python Postgres psycopg2 ThreadedConnectionPool exhausted

eatmeimadanish
  • 3,809
  • 1
  • 14
  • 20