Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(providers.google): add setter to BigQueryInsertJobOperator sql property #33211

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