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

Handle empty statement in psycopg instrumentation #2644

Merged
merged 6 commits into from
Jul 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor empty string check
  • Loading branch information
Holi0317 committed Jun 29, 2024
commit 85b5014c5fa3a67814b1320e23defa65bf5c88bd
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def get_operation_name(self, cursor, args):
statement = statement.as_string(cursor)

# `statement` can be empty string. See #2643
xrmx marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(statement, str) and statement != "":
if statement and isinstance(statement, str):
# Strip leading comments so we get the operation name.
return self._leading_comment_remover.sub("", statement).split()[0]

Expand Down