feat(chalice): recreate cursor

This commit is contained in:
Taha Yassine Kraiem 2022-10-21 15:26:07 +02:00
parent ef456145e0
commit d1da53709f

View file

@ -141,6 +141,13 @@ class PostgresClient:
and not self.unlimited_query:
postgreSQL_pool.putconn(self.connection)
def recreate_cursor(self):
try:
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)
def close():
pass