Skip to content

Commit

Permalink
Re-write remove_ending_semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
surister committed Apr 11, 2024
1 parent e1b050c commit 526f087
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions connectorx-python/connectorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from importlib_metadata import version

__version__ = version(__name__)

except:
pass

Expand Down Expand Up @@ -388,8 +389,15 @@ def reconstruct_pandas(df_infos: Dict[str, Any]):


def remove_ending_semicolon(query: str) -> str:
if query[-1] == ';':
query= list(query)
query.pop(-1)
query = "".join(query)
"""
Removes the semicolon if the query ends with it.
Parameters
==========
query
SQL query
"""
if query.endswith(';'):
query = query[:-1]
return query

0 comments on commit 526f087

Please sign in to comment.