dinigo commented on issue #13750:
URL: https://github.com/apache/airflow/issues/13750#issuecomment-889471613
In cae someone comes around looking for a solution for this. I solved it
with this quick fix
```python
class BigQuerySqlSensor(SqlSensor):
""" Overwrites the use_legacy_sql when using SqlSensor with a BigQuery
connection"""
def _get_hook(self):
hook = super()._get_hook()
hook.use_legacy_sql = False
hook.location = Variable.get('location')
return hook
sense_data = BigQuerySqlSensor(
task_id="sense_data",
conn_id="google_default",
sql="select count(*) > 0 from `my_dataset.my_view`",
)
```
Apart from this quick fix I see the point on defaulting to the "legacy"
dialect to keep backwards compatibility. I see two solutions for this issue:
1. Expose and read the dialect version from the connection extras
2. Set the flag dynamically from the sql code if it starts with
`#starndardSQL` like the [docs
mention](https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql#sql-prefix)
Both of them can be implemented. Any thoughts on what could be preferable?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]