Skip to content
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

The sqlcommenter cannot take non string queries #1477

Open
leoskyrocker opened this issue Dec 7, 2022 · 3 comments · May be fixed by #3113
Open

The sqlcommenter cannot take non string queries #1477

leoskyrocker opened this issue Dec 7, 2022 · 3 comments · May be fixed by #3113
Labels
bug Something isn't working help wanted Extra attention is needed instrumentation

Comments

@leoskyrocker
Copy link

leoskyrocker commented Dec 7, 2022

We observe this issue using the sqlcommenter with the psycopg2 instrumentor. The commenter doesn't support all types of query execution in psycopg2.

Steps to reproduce
cursor.execute(sql.SQL("SELECT 1"))

What is the expected behavior?
Both cursor.execute(sql.SQL("SELECT 1")) or cursor.execute("SELECT 1") should work.
The sqlcommenter should be able to work with the psycopg2.sql.SQL() objects (which is a subclass of psycopg2.sql.Composable) passed into the cursor.execute().

What is the actual behavior?
cursor.execute(sql.SQL("SELECT 1")) fails while cursor.execute("SELECT 1") works.
The sqlcommenter assumes that a Python string is passed in, and it will try to call .rstrip() on the query object. In case of a composable that is passed in, it would blow up and eventually caught in the execption.

@leoskyrocker leoskyrocker added the bug Something isn't working label Dec 7, 2022
@srikanthccv srikanthccv added help wanted Extra attention is needed instrumentation labels Dec 7, 2022
@Akochavi
Copy link
Contributor

Akochavi commented Feb 1, 2023

Can you assign this to me please?

@leoskyrocker
Copy link
Author

hi @Akochavi is there any plans on this one?

@Akochavi Akochavi removed their assignment Jun 8, 2023
@Akochavi
Copy link
Contributor

Akochavi commented Jun 8, 2023

@leoskyrocker No, you can take it.

@aryabharat aryabharat linked a pull request Dec 17, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed instrumentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants