Skip to content

Commit

Permalink
Fix change in how we access TransactionStatus enum in psycopg3.
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Jul 1, 2024
1 parent 09a1f78 commit 49ba1cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion playhouse/psycopg3_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
try:
import psycopg
from psycopg.types.json import Jsonb
from psycopg.pq import TransactionStatus
except ImportError:
psycopg = Jsonb = None

Expand Down Expand Up @@ -160,7 +161,7 @@ def is_connection_usable(self):
# connection. If the connection is in an error state or the connection
# is otherwise unusable, return False.
conn = self._state.conn
return conn.pgconn.transaction_status < conn.TransactionStatus.INERROR
return conn.pgconn.transaction_status < TransactionStatus.INERROR

def extract_date(self, date_part, date_field):
return fn.EXTRACT(NodeList((SQL(date_part), SQL('FROM'), date_field)))

0 comments on commit 49ba1cc

Please sign in to comment.