diff --git a/airflow/providers/google/cloud/operators/bigquery.py b/airflow/providers/google/cloud/operators/bigquery.py index d6654141532a..99a15e66d075 100644 --- a/airflow/providers/google/cloud/operators/bigquery.py +++ b/airflow/providers/google/cloud/operators/bigquery.py @@ -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"):