Using pgdb for python2 db-api access to postgresql? Migrating to python3? You can use postgresql.driver.dbapi20 to painlessly cutover as long as you set host=None, port=None, and unix="/var/run/postgresql/.s.PGSQL.5432" (or whereever you put your postgresql local unix socket) when connect'ing via local unix sockets (the default in pgdb and not the default in postgresql.driver.dbapi20).