tmccall8829 opened a new issue, #28343:
URL: https://github.com/apache/airflow/issues/28343

   ### Apache Airflow Provider(s)
   
   google
   
   ### Versions of Apache Airflow Providers
   
   `apache-airflow-providers-google==8.6.0`
   
   ### Apache Airflow version
   
   v2.3.4
   
   ### Operating System
   
   Composer (so I think debian, probably?)
   
   ### Deployment
   
   Composer
   
   ### Deployment details
   
   We use a standard/vanilla composer deployment setup -- nothing fancy.
   
   ### What happened
   
   Using the following BigQueryColumnCheckOperator block:
   ```
   # minimum_valid_fresh_date is a pendulum datetime obj
   basic_column_quality_checks = BigQueryColumnCheckOperator(
           task_id="check_columns",
           table="my_dataset.my_table",
           use_legacy_sql=False,
           column_mapping={
               "updated_at": {"min": {"geq_to": minimum_valid_fresh_date}},
           },
       )
   ```
   
   results in the following error in airflow:
   ```
   google.api_core.exceptions.BadRequest: 400 Querying tables with INTERVAL or 
JSON type is not supported in Legacy SQL: 787345995969:my_dataset.my_table.
   ```
   
   This occurs even though `use_legacy_sql` is set to `False`.
   
   ### What you think should happen instead
   
   Not sure if the problem here is that the error message is wrong/outdated, or 
if the `use_legacy_sql` flag isn't being actually passed through to 
`BigQueryHook()` when it gets called in 
`BigQueryColumnCheckOperator._submit_job()`. Either way, we should _not_ be 
using legacy SQL in this case, since we explicitly specify 
`use_legacy_sql=False`.
   
   ### How to reproduce
   
   Run a simple DAG with just a single task (the operator I pasted above) on 
airflow v2.3.4 with `apache-airflow-providers-google==8.6.0`. The BQ table in 
question should have a column `updated_at`.
   
   ### Anything else
   
   Digging into source, I _think_ the problem is that the returned hook in 
`BigQueryColumnCheckOperator._submit_job()` does not get passed 
`self.use_legacy_sql`, so the hook obj just uses the default (which is set to 
`True`). If it's really that simple, happy to submit a PR to fix!
   
   FWIW, it actually seems like this occurs in other BigQuery operators defined 
here as well... it could definitely be that I'm misreading the source, though, 
so apologies if that's the case!
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to