-
Notifications
You must be signed in to change notification settings - Fork 74
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
SQL errors cause UserWarning: DB-API extension cursor.connection used self._run_cursor.execute(sql, params, stream=stream) to be displayed #204
Comments
Hi @patatwork365 , thank you for reporting this issue. This warning is due to the error handling logic within A fix is needed to address this behavior where we retain the current logging capabilities but no longer raise this warning. From a quick look, this fix is likely as simple from changing the logging calls from:
to
as |
Thanks @Brooke-white for the analysis. |
Thanks, @patatwork365 . I'll give it a few days to see if anyone else would like to contribute and will raise a PR myself otherwise. |
Hi folks, this fix will be in our February release |
…iables when exception is raised. resolves db-api extension warnings #204
Hi @patatwork365 , we've fixed this in 2.1.0 thanks for your patience :) |
Driver version
redshift-connector 2.0.917
Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.61626�
Client Operating System
Linux cc7c404a8a4d 6.5.11-linuxkit #1 SMP PREEMPT Wed Dec 6 17:08:31 UTC 2023 x86_64 GNU/Linux
Python version
3.11.7
Table schema
Problem description
When a SQL error occurs the warning 'UserWarning: DB-API extension cursor.connection used self._run_cursor.execute(sql, params, stream=stream)' is logged.
Catching the raised exception does not suppress the warning
Python Driver trace logs
Reproduction code
Output
What's the magic word! :
"select 'I
m a teapot' " "respond 'You
re a teapot' "/home/vscode/.local/lib/python3.11/site-packages/redshift_connector/core.py:1321: UserWarning: DB-API extension cursor.connection used
self._run_cursor.execute(sql, params, stream=stream)
("{'S': 'ERROR', 'C': '42601', 'M': 'syntax error at or near "
'"respond"', 'P': '1', 'F': '
"'/home/ec2-user/padb/src/pg/src/backend/parser/parser_scan.l', 'L': '840', "
"'R': 'yyerror'}")
"select 'Who
s a teapot' " "respond'You
re a teapot' "("{'S': 'ERROR', 'C': '42601', 'M': 'syntax error at or near "
'"respond"', 'P': '1', 'F': '
"'/home/ec2-user/padb/src/pg/src/backend/parser/parser_scan.l', 'L': '840', "
"'R': 'yyerror'}")
[(['I
m a teapot'],), None, (['Who
s a teapot'],), None]The text was updated successfully, but these errors were encountered: