Skip to content

Instantly share code, notes, and snippets.

@rupython
Created February 20, 2019 10:39
Show Gist options
  • Save rupython/6888738779a0c500315e65fce558b229 to your computer and use it in GitHub Desktop.
Save rupython/6888738779a0c500315e65fce558b229 to your computer and use it in GitHub Desktop.
From: Nix
вот мой пример
def execute(self, sql, args=None, commit=False):
conn = self.pool.get_connection()
cursor = conn.cursor(dictionary=True)#,buffered=True)
if args:
cursor.execute(sql, args)
else:
cursor.execute(sql)
if commit is True:
conn.commit()
self.close(conn, cursor)
return None
else:
res = cursor.fetchall()
self.close(conn, cursor)
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment