This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 128cb5c6bcd Merge internal methods with public ones in model variables
(#44543)
128cb5c6bcd is described below
commit 128cb5c6bcd6125418e18fe413aa8df2fce23c6d
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Dec 1 21:19:32 2024 +0100
Merge internal methods with public ones in model variables (#44543)
Follow up after #44525
---
airflow/models/variable.py | 60 ----------------------------------------------
1 file changed, 60 deletions(-)
diff --git a/airflow/models/variable.py b/airflow/models/variable.py
index 4b3e4f77e47..b4cf5560e84 100644
--- a/airflow/models/variable.py
+++ b/airflow/models/variable.py
@@ -165,34 +165,6 @@ class Variable(Base, LoggingMixin):
This operation overwrites an existing variable.
- :param key: Variable Key
- :param value: Value to set for the Variable
- :param description: Description of the Variable
- :param serialize_json: Serialize the value to a JSON string
- :param session: Session
- """
- Variable._set(
- key=key, value=value, description=description,
serialize_json=serialize_json, session=session
- )
- # invalidate key in cache for faster propagation
- # we cannot save the value set because it's possible that it's
shadowed by a custom backend
- # (see call to check_for_write_conflict above)
- SecretCache.invalidate_variable(key)
-
- @staticmethod
- @provide_session
- def _set(
- key: str,
- value: Any,
- description: str | None = None,
- serialize_json: bool = False,
- session: Session = None,
- ) -> None:
- """
- Set a value for an Airflow Variable with a given Key.
-
- This operation overwrites an existing variable.
-
:param key: Variable Key
:param value: Value to set for the Variable
:param description: Description of the Variable
@@ -225,26 +197,6 @@ class Variable(Base, LoggingMixin):
"""
Update a given Airflow Variable with the Provided value.
- :param key: Variable Key
- :param value: Value to set for the Variable
- :param serialize_json: Serialize the value to a JSON string
- :param session: Session
- """
- Variable._update(key=key, value=value, serialize_json=serialize_json,
session=session)
- # We need to invalidate the cache for internal API cases on the client
side
- SecretCache.invalidate_variable(key)
-
- @staticmethod
- @provide_session
- def _update(
- key: str,
- value: Any,
- serialize_json: bool = False,
- session: Session = None,
- ) -> None:
- """
- Update a given Airflow Variable with the Provided value.
-
:param key: Variable Key
:param value: Value to set for the Variable
:param serialize_json: Serialize the value to a JSON string
@@ -268,18 +220,6 @@ class Variable(Base, LoggingMixin):
"""
Delete an Airflow Variable for a given key.
- :param key: Variable Keys
- """
- rows = Variable._delete(key=key, session=session)
- SecretCache.invalidate_variable(key)
- return rows
-
- @staticmethod
- @provide_session
- def _delete(key: str, session: Session = None) -> int:
- """
- Delete an Airflow Variable for a given key.
-
:param key: Variable Keys
"""
rows = session.execute(delete(Variable).where(Variable.key ==
key)).rowcount