Missing support for UPDATE + JOIN in BigQuery dialect. #1010
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: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Uh oh!
There was an error while loading. Please reload this page.
Environment
sqlalchemy
version 1.4.50sqlalchemy-bigquery
version 1.9Steps to reproduce
Assume a BigQuery dataset has two tables:
tbl_foo
andtbl_bar
.You want to UPDATE values in
tbl_foo
, using a JOIN againsttbl_bar
.The compiled SQL should look something like this:
BigQuery does indeed support this (^) SQL syntax. I successfully ran this statement in a browser with Google Cloud and BigQuery Explorer.
However, when the Python shown above is executed, this error is thrown:
I did some investigation. The root cause is that base SQLCompiler class has a function named
update_from_clause
that looks like this (GitHub).Built-in Alchemy dialects (like PostgreSQL) overrride
update_from_clause
function, as shown in code here (GitHub).Issue : The BigQuery dialect offered by
sqlalchemy-bigquery
does not override this function.NOTE: I tried to override
update_from_clause
in my development environment, adding it to../sqlalchemy_bigquery/base.py
.But this did not succeed. At runtime, Python didn't recognize my change, and continued to throw the NotImplementedError error from the original SQLCompiler class. 😕
To be fair, I don't exactly understand how
sqlalchemy-bigquery
is patching and overriding the vanillasqlalchemy
code (some kind of guerilla patching during import?). I tried deleting all my bytecode and__pycache__
, but that didn't seem to help.The text was updated successfully, but these errors were encountered: