diff --git a/mylib/pgsql.py b/mylib/pgsql.py index b6e6864..f2fb2d0 100644 --- a/mylib/pgsql.py +++ b/mylib/pgsql.py @@ -133,6 +133,14 @@ class PgDB: cursor = self._conn.cursor() try: + log.debug( + 'Run SQL query "%s" %s', + sql, + "with params = %s" % ', '.join([ + "%s = %s" % (key, value) + for key, value in params.items() + ]) if params else "without params" + ) if params is None: cursor.execute(sql) else: @@ -141,7 +149,7 @@ class PgDB: return True except Exception: log.error( - 'Error during SQL request "%s" %s', + 'Error during SQL query "%s" %s', sql, "with params = %s" % ', '.join([ "%s = %s" % (key, value) @@ -164,12 +172,20 @@ class PgDB: """ cursor = self._conn.cursor() try: + log.debug( + 'Run SQL SELECT query "%s" %s', + sql, + "with params = %s" % ', '.join([ + "%s = %s" % (key, value) + for key, value in params.items() + ]) if params else "without params" + ) cursor.execute(sql, params) results = cursor.fetchall() return results except Exception: log.error( - 'Error during SQL request "%s" %s', + 'Error during SQL query "%s" %s', sql, "with params = %s" % ', '.join([ "%s = %s" % (key, value)