-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Labels
api: spannerIssues related to the googleapis/python-spanner API.Issues related to the googleapis/python-spanner API.
Description
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/python-spanner/issues ✅
- Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python ✅
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS type and version:
- Python version: 3.10
- pip version: 25.2
google-cloud-spannerversion: 3.55.0
Steps to reproduce
- Have a Json column in Spanner with schema like e.g. {"a": 1, "b": [2,3]}
- execute SQL selecting field b
- Attempt to index into the array contained by b
- error raised
Code example
with my_database.snapshot() as snapshot:
result = snapshot.execute_sql("SELECT JSON_QUERY(my_json_col, '$."b"') as b_col
isinstance(b_col, google.cloud.spanner_v1.data_types.JsonObject) # True
b_col[0] # raises error Stack trace
Traceback (most recent call last):
File "<string>", line 1, in <module>
KeyError: 0
Basically, I see that holding arrays is seen as possible in JsonObject (
| self._is_array = len(args) and isinstance(args[0], (list, tuple)) |
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/python-spanner API.Issues related to the googleapis/python-spanner API.