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
Unable to create temporary table to load batch data #1012
Comments
Is this the same error as #569 in a different context? |
I think it's very related yes; unfortunately the underlying problem appears to be that SQLAlchemy doesn't provide a high-level API for creating a temporary table or require drivers to provide a DDL translation (which is probably because there's so much variety of support and behavior). I'd love ideas for how to improve this and make it more streamlined. |
It looks like sqlalchemy is unsure what schema to execute the statement in. Or giving the user you are connecting as a default schema in Snowflake? |
I've added schema to the connection string as well (see below) but that yields the same error when trying pass the query into batch_kwargs:
I'll look into using a default schema for the user. As a workaround, using @jcampbell suggestion of utilizing a PandasDatasource instead SqlAlchemyDatasource:
|
Should we use snowflake-sqlalchemy tool for snowflake communications? |
@NelsonTorres : yes, that's the right driver! An update here: this is definitely something we'll have to add some workaround for, since currently we don't have a good way to create the temporary tables using the high-level SQLAlchemy API so end up having lots of dialect-specific issues. I'd be happy to merge in a PR that addresses Snowflake-specific syntax into the create temporary table logic of |
I updated this title because the issue is common outisde of snowflake; we need to essentially create a better way to detect the backend and adjust the temporary table creation logic:
|
Signed-off-by: James Campbell <james.p.campbell@gmail.com>
Signed-off-by: James Campbell <james.p.campbell@gmail.com>
Fixed in 0.9.3 |
@armaandhull : unfortunately, the fix doesn't work with the CLI yet; there is an open PR now (#1129) that will update the CLI to take advantage of the change (and it also changes the relevant batch_kwarg for declaring a snowflake table to |
@armaandhull : the new 0.9.4 release supports snowflake through the |
@jcampbell thanks for the update 👍 will try it out with 0.9.4 |
@jcampbell Is there plan to fix this for Oracle as well? |
Current Behavior
When generating a batch of data pointing to snowflake sql database to validate the datasource using a query, this throws error stating a snowflake error with CANNOT CREATE TABLE. (see screenshot)
See below:
batch_query = """ select * from network_outreach where dispatch_request_time_utc >= to_date('2020-01-01') and dispatch_request_time_utc < to_date('2020-01-07'); """
batch_kwargs = {'table': "network_outreach", 'schema': 'dbo', 'query': batch_query}
batch = context.get_batch(data_asset_name=normalized_data_asset_name, expectation_suite_name=expectation_suite_name, batch_kwargs=batch_kwargs) print(batch.get_row_count())
Ideal behavior
batch_kwargs will allow raw query to be taken into account to allow the formation of a temp table pointing to snowflake database to create batch off.
The text was updated successfully, but these errors were encountered: