-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/pg semicolon support #599
Feat/pg semicolon support #599
Conversation
@wangxiaoying I think this one is ready for review. Let me know if/what changes are needed. Thanks in advance! |
Hi @Jordan-M-Young , thanks for the PR! I think my concern is that ';' may also appears in other parts of the query, such as string matching. For example: I would suggest to only replace the ";" if it is the last valid character in the sql query. Such as |
@wangxiaoying Thanks for the suggestion. I believe my newest commit should allay that concern. If you wouldn't mind taking another look I'd appreciate it. |
Thank you @Jordan-M-Young ! I have merged the PR. |
@@ -377,3 +385,11 @@ def reconstruct_pandas(df_infos: Dict[str, Any]): | |||
) | |||
df = pd.DataFrame(block_manager) | |||
return df | |||
|
|||
|
|||
def remove_ending_semicolon(query: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit cumbersome. Could be rewritten to:
if query.endswith(';'):
query = query[:-1]
return query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @surister , indeed this way can be better. Can you open a PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got it.
Implementing support for finishing postgres queries with a semicolon per this issue.
Changes include:
- replace statements to remove semicolon from query in connectorx-python/connectorx/init.py (read_sql)
- Tests to confirm that command terminating semicolons are being removed.