get the query to return results, or an empty list if any error occurs

This commit is contained in:
Camryn Thomas 2024-01-14 13:53:34 -06:00
parent 997dc064e6
commit e3d8a31285
Signed by: cptlobster
GPG Key ID: 6D341D688163A176

View File

@ -24,7 +24,13 @@ class DBConnector:
self.conn.close()
def _query(self, sql):
self.cur.execute(sql)
try:
self.cur.execute(sql)
result = self.cur.fetchall()
except psycopg2.DatabaseError as e:
result = []
return result
def read(self, **kwargs):
"""Read rows from a database that match the specified filters.