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

Improper initialisation of JsonObject when param itself is JsonObject whose top level is a list #1154

Closed
forksumit opened this issue Jun 23, 2024 · 0 comments · Fixed by #1166
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API.

Comments

@forksumit
Copy link
Contributor

When calling JsonObject on a JsonObject when top level of data is a list (ex: JsonObject(JsonObject([{"k": "v"}]))) returns a empty JsonObject ({})

Environment details

  • OS: MacOS / Linux
  • Python version: 3.11.4
  • pip version: 24.0
  • google-cloud-spanner version: 3.47.0

Steps to reproduce

from google.cloud.spanner_v1 import JsonObject

data = {"key": "value"}
x = JsonObject(data)
y = JsonObject(x)
print(x, y)

data = [{"key": "value"}]
x = JsonObject(data)
y = JsonObject(x)
print(x, y)

Expected Output:

{'key': 'value'} {'key': 'value'}
[{'key': 'value'}] [{'key': 'value'}]

Got Output:

{'key': 'value'} {'key': 'value'}
[{'key': 'value'}] {}

If fixed, should also fix: googleapis/python-spanner-sqlalchemy#404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API.
Projects
None yet
3 participants