Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

[spanner_dbapi] While running a query that contains just comment, it causes an IndexError exception #1178

@bhatt4982

Description

@bhatt4982

In Cursor -> execute(), while running a query that contains just comment, it causes an IndexError exception

Example query>> --comment
Error: IndexError: tuple index out of range
File "/Users/sanjeevbhatt/github/python-spanner-dev/google/cloud/spanner_dbapi/parse_utils.py", line 354, in ensure_where_clause
if any(isinstance(token, sqlparse.sql.Where) for token in sqlparse.parse(sql)[0]):
Note: Go cli returns “Error: Invalid Statement”

Environment details

  • Python version: 3.12.4
  • pip version: 24.1
  • google-cloud-spanner version: 3.47.0

Code example

query = "--comment"
cursor.execute(query)

Stack trace

Error: IndexError: tuple index out of range
File "/Users/sanjeevbhatt/github/python-spanner-dev/google/cloud/spanner_dbapi/parse_utils.py", line 354, in ensure_where_clause
if any(isinstance(token, sqlparse.sql.Where) for token in sqlparse.parse(sql)[0]):

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: spannerIssues related to the googleapis/python-spanner API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions