Skip to content

Commit

Permalink
Raise AirflowException in runtime check
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored and david30907d committed Feb 13, 2022
1 parent 7dd327c commit e82c4fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions airflow/providers/google/cloud/hooks/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def get_sqlalchemy_engine(self, engine_kwargs=None):
"and extra__google_cloud_platform__keyfile_dict"
)

def get_records(self, sql, parameters=None):
if self.location is None:
raise AirflowException("Need to specify 'location' to use BigQueryHook.get_records()")
return super().get_records(sql, parameters=parameters)

@staticmethod
def _resolve_table_reference(
table_resource: Dict[str, Any],
Expand Down Expand Up @@ -2579,11 +2584,6 @@ 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!")
return super().get_records()


class BigQueryCursor(BigQueryBaseCursor):
Expand Down

0 comments on commit e82c4fa

Please sign in to comment.