Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cdc70c9

Browse files
committedFeb 28, 2025·
Handle empty strings
Safer check for a trailing semicolon that could handle empty strings as well.
1 parent c09a299 commit cdc70c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎opentelemetry-instrumentation/src/opentelemetry/instrumentation/sqlcommenter_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _add_sql_comment(sql, **meta) -> str:
2323
meta.update(**_add_framework_tags())
2424
comment = _generate_sql_comment(**meta)
2525
sql = sql.rstrip()
26-
if sql[-1] == ";":
26+
if sql.endswith(";"):
2727
sql = sql[:-1] + comment + ";"
2828
else:
2929
sql = sql + comment

0 commit comments

Comments
 (0)
Please sign in to comment.