From 49ba1ccddd1d0a8f2e7f6a339d44195f5c40c076 Mon Sep 17 00:00:00 2001 From: Charles Leifer Date: Mon, 1 Jul 2024 11:12:40 -0500 Subject: [PATCH] Fix change in how we access TransactionStatus enum in psycopg3. --- playhouse/psycopg3_ext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/playhouse/psycopg3_ext.py b/playhouse/psycopg3_ext.py index 5b6fb0720..61b2ace3d 100644 --- a/playhouse/psycopg3_ext.py +++ b/playhouse/psycopg3_ext.py @@ -16,6 +16,7 @@ try: import psycopg from psycopg.types.json import Jsonb + from psycopg.pq import TransactionStatus except ImportError: psycopg = Jsonb = None @@ -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)))