Skip to content

Commit

Permalink
fix execute
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Dec 30, 2022
1 parent d885c5c commit 207cc87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion databend_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python

VERSION = (0, 0, 6)
VERSION = (0, 0, 8)
__version__ = '.'.join(str(x) for x in VERSION)
8 changes: 2 additions & 6 deletions databend_sqlalchemy/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def escape_item(self, item):
elif isinstance(item, datetime):
return self.escape_string(item.strftime("%Y-%m-%d %H:%M:%S"))
else:
raise Exception("Unsupported object {}".format(item))
return self.escape_string(item)


_escaper = ParamEscaper()
Expand Down Expand Up @@ -170,18 +170,14 @@ def close(self):

def execute(self, operation, parameters=None, is_response=True):
"""Prepare and execute a database operation (query or command). """
if parameters is None or not parameters:
sql = operation
else:
sql = operation % _escaper.escape_args(parameters)

self._reset_state()

self._state = self._STATE_RUNNING
self._uuid = uuid.uuid1()

if is_response:
column_types, response = self._db.execute(sql, with_column_types=True)
column_types, response = self._db.execute(operation, parameters, with_column_types=True)
self._process_response(column_types, response)

def executemany(self, operation, seq_of_parameters):
Expand Down

0 comments on commit 207cc87

Please sign in to comment.