Skip to content

Commit

Permalink
Force remove semi-colon
Browse files Browse the repository at this point in the history
Force remove of ; from queries. This is useful when using sqlalchemy-iris with LangChain as generated queries often have ; even when prompted not to
  • Loading branch information
OneLastTry authored Jun 13, 2023
1 parent 6d7e72d commit d5a815f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sqlalchemy_iris/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,10 +1019,14 @@ def _debug_pre(self, query, params, many=False):
print("-- @param = %r" % (p,))

def do_execute(self, cursor, query, params, context=None):
if query.endswith(";"):
query = query[:-1]
self._debug(query, params)
cursor.execute(query, params)

def do_executemany(self, cursor, query, params, context=None):
if query.endswith(";"):
query = query[:-1]
self._debug(query, params, True)
cursor.executemany(query, params)

Expand Down

0 comments on commit d5a815f

Please sign in to comment.