get the query to return results, or an empty list if any error occurs
This commit is contained in:
parent
997dc064e6
commit
e3d8a31285
@ -24,7 +24,13 @@ class DBConnector:
|
|||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
||||||
def _query(self, sql):
|
def _query(self, sql):
|
||||||
|
try:
|
||||||
self.cur.execute(sql)
|
self.cur.execute(sql)
|
||||||
|
result = self.cur.fetchall()
|
||||||
|
except psycopg2.DatabaseError as e:
|
||||||
|
result = []
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def read(self, **kwargs):
|
def read(self, **kwargs):
|
||||||
"""Read rows from a database that match the specified filters.
|
"""Read rows from a database that match the specified filters.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user