def pg_fetch(self, psql, sql, processor=None):
# Implement common management of customizable queries
# Disabled inspection
if sql is None:
return []
try:
if isinstance(sql, list):
# Static inspection
rows = sql[:]
else:
rows = psql(sql)
if processor:
rows = processor(rows)
if not isinstance(rows, list):
rows = list(rows)
return rows
except psycopg2.ProgrammingError as e:
# Consider the query as user defined
raise UserError(str(e))
评论列表
文章目录