uranusjr commented on a change in pull request #19571:
URL: https://github.com/apache/airflow/pull/19571#discussion_r749869076
##########
File path: airflow/providers/google/cloud/hooks/bigquery.py
##########
@@ -2630,6 +2630,11 @@ def run_query(self, *args, **kwargs) -> str:
stacklevel=3,
)
return self.hook.run_query(*args, **kwargs)
+
+ def get_records(self, sql, parameters=None):
+ if self.location is None:
+ raise Exception("Need to specify location when instantiating
BigQueryHook, otherwise it would result in Job Not Found error!")
Review comment:
OK this sounds like a good reason.
Could you change this to raise `AirflowException` (or a subclass
`BigQueryLocationUnset`) instead? This pattern is more common in Airflow than
raising a barebone `Exception`.
I’d do
```python
raise BigQueryLocationUnset("Parameter 'location' is required to fetch
records with BigQuery hook")
```
--
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]