Skip to content

Execution of STRUCT item access doesn't work. #293

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

Closed
jimfulton opened this issue Aug 24, 2021 · 0 comments · Fixed by #318
Closed

Execution of STRUCT item access doesn't work. #293

jimfulton opened this issue Aug 24, 2021 · 0 comments · Fixed by #318
Labels
api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@jimfulton
Copy link
Contributor

Compilation works:

>>> select([t], t.c.object['object_id']=='x')
<sqlalchemy.sql.selectable.Select object at 0x7f120baf18d0>

But execution doesn't:

>>> conn.execute(select([t], t.c.object['object_id']=='x'))
Traceback (most recent call last):
  File "/home/jim/.pyenv/versions/3.6.13/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 2071, in visit_binary
    opstring = OPERATORS[operator_]
KeyError: <function json_getitem_op at 0x7f120bfa9d08>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
...
  File "/home/jim/.pyenv/versions/3.6.13/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
sqlalchemy.exc.UnsupportedCompilationError: Compiler <pybigquery.sqlalchemy_bigquery.BigQueryCompiler object at 0x7f120baf1a20> can't render element of type <function json_getitem_op at 0x7f120bfa9d08> (Background on this error at: https://sqlalche.me/e/14/l7de)
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. label Aug 24, 2021
@jimfulton jimfulton changed the title Execution of JSON (record/struct) item access doesn't work. Execution of STRUCT item access doesn't work. Aug 26, 2021
@meredithslota meredithslota added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants