Closed machow closed 2 years ago
Thanks @machow -- this does not seem to work for me. I can run the example with mock_sqlalchemy_engine
as written but I can't run it from BigQuery.
I think that in mock_sqlalchemy_engine
it might always be using postgresql
rather than actually using the dialect argument that was passed in?
For example, this does not work for me:
from sqlalchemy.engine import Engine
from sqlalchemy.dialects import registry
from siuba.sql import LazyTbl
from siuba import *
# manually construct BigQuery engine following the pattern in mock_sqlalchemy_engine
dialect_cls = registry.load('bigquery')
engine = Engine(None, dialect_cls(), '')
test_tbl = LazyTbl(engine, "test_table", ["x", "y", "z", "calitp_itp_id"])
q = test_tbl >> mutate(res = _.x.isin([1,2])) >> show_query()
I get this error: AssertionError: Unexpected param: (1, 2)
(which is the same error I get when pointing at our actual BigQuery data.) Full error collapsed below for readability.
I get this error: AssertionError: Unexpected param: (1, 2)
Ah, I think it's likely an issue with whatever version of the sqlalchemy-bigquery dialect is installed (edit: I just logged into calitp's cluster, and I think it's pybigquery==0.10.2
). They rebranded it to sqlalchemy-bigquery.
Going to close, since the issue with .isin
should resolve with upgrading, but let's re-open / open a new issue if the verb_dispatch usecase becomes relevant
From @lauriemerrell, moving to a github issue. Can you let me know if this does what you're looking for? :)
Querying using the
.isin()
methodImplementing a new verb
See
Here's an example, building off the code above