From dafb88e54283141ea15287dc98579e1f3155997d Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 21 Oct 2022 17:42:45 +0200 Subject: [PATCH] feat(chalice): changed recreate cursor for pg_client --- api/chalicelib/utils/pg_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/chalicelib/utils/pg_client.py b/api/chalicelib/utils/pg_client.py index 8da809418..b11ba4079 100644 --- a/api/chalicelib/utils/pg_client.py +++ b/api/chalicelib/utils/pg_client.py @@ -147,7 +147,8 @@ class PostgresClient: self.cursor.close() except Exception as error: logging.error("Error while closing cursor for recreation", error) - self.cursor = self.connection.cursor(cursor_factory=psycopg2.extras.RealDictCursor) + self.cursor = None + self.__enter__() def close():