Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
vegitron committed Apr 11, 2017
1 parent 9912ea8 commit 93632db
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sqlshare_rest/backend/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ def remove_schema(self, schema):
cursor.execute(sql)
cursor.close()

def run_named_cursor_query(self, sql, user, params=None, return_cursor=False,
query=None):
def run_named_cursor_query(self, sql, user, params=None,
return_cursor=False, query=None):
connection = self.get_connection_for_user(user)
connection.set_session(autocommit=False)

if query:
query.backend_terminate_data = "%s" % connection.get_backend_pid()
query.save()

cursor = connection.cursor('cursor-%s-%s' % (time.time(), random.random()))
cursor = connection.cursor('cursor-%s-%s' % (time.time(),
random.random()))
cursor.execute(sql.encode('utf-8'), params)

if return_cursor:
Expand Down

0 comments on commit 93632db

Please sign in to comment.