Skip to content

Commit

Permalink
postgres: replace connection.info with connection.connection.info
Browse files Browse the repository at this point in the history
  • Loading branch information
altairbow committed Oct 14, 2023
1 parent 9ff28af commit 557d19e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
8 changes: 1 addition & 7 deletions dj_db_conn_pool/backends/postgresql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@


class DatabaseWrapper(PGDatabaseWrapperMixin, base.DatabaseWrapper):
def get_new_connection(self, conn_params):
connection = super().get_new_connection(conn_params)

if not connection.info:
connection.info = connection.connection.info

return connection
pass
28 changes: 18 additions & 10 deletions dj_db_conn_pool/backends/postgresql/mixins.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# coding: utf-8

from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2

from dj_db_conn_pool.core.mixins import PersistentDatabaseWrapperMixin


class PGDatabaseWrapperMixin(PersistentDatabaseWrapperMixin):
class SQLAlchemyDialect(PGDialect_psycopg2):
pass
# coding: utf-8

from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2

from dj_db_conn_pool.core.mixins import PersistentDatabaseWrapperMixin


class PGDatabaseWrapperMixin(PersistentDatabaseWrapperMixin):
class SQLAlchemyDialect(PGDialect_psycopg2):
pass

def get_new_connection(self, conn_params):
connection = super().get_new_connection(conn_params)

if not connection.info:
connection.info = connection.connection.info

return connection

0 comments on commit 557d19e

Please sign in to comment.