Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions airflow/providers/google/cloud/operators/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2739,11 +2739,28 @@ def __init__(

@property
def sql(self) -> str | None:
_sql = getattr(self, "_sql", None)
if _sql:
return _sql

try:
return self.configuration["query"]["query"]
except KeyError:
return None

@sql.setter
def sql(self, sql_value: str):
warnings.warn(
(
"Assigning value to sql is deprecated. "
"This setter will be removed in the next major release and"
" will raise an AttributeError when assigning value to sql"
),
AirflowProviderDeprecationWarning,
stacklevel=2,
)
self._sql = sql_value

def prepare_template(self) -> None:
# If .json is passed then we have to read the file
if isinstance(self.configuration, str) and self.configuration.endswith(".json"):
Expand Down