SameerMesiah97 commented on code in PR #72484:
URL: https://github.com/apache/airflow/pull/72484#discussion_r3927573076
##########
airflow-core/src/airflow/cli/utils.py:
##########
@@ -100,6 +101,43 @@ def print_export_output(command_type: str, exported_items:
Collection, file: Tex
print(f"{len(exported_items)} {command_type} successfully exported to
{file.name}.")
+def get_hidden_entries_warning(entity_name: str, env_prefix: str) -> str |
None:
+ """
+ Build a warning about entries this listing cannot show.
+
+ Connections and Variables can be defined in three places: the metadata
database, environment
+ variables, and an optional secrets backend. The database is checked last,
so an environment
+ variable or a secrets backend entry silently takes precedence over a
database row with the same
+ ID. Commands that only enumerate database rows (like ``connections list``
/ ``variables list``)
+ should surface that gap explicitly instead of presenting the database rows
as the full picture.
Review Comment:
This is too long. I would suggest the below:
```
"""Return a warning when the database listing may be incomplete
:param entity_name: Human-readable plural noun to use in the message,
e.g. ``"connections"``.
:param env_prefix: Environment variable prefix used for this entity,
e.g. ``AIRFLOW_CONN_``.
:return: A warning message, or ``None`` if neither hiding source appears
to be in use."""
# Connections and variables may also come from environment variables or a
# custom secrets backend. These sources can override database entries but
# are not included by commands that enumerate database rows.
```
##########
airflow-core/src/airflow/cli/utils.py:
##########
@@ -100,6 +101,43 @@ def print_export_output(command_type: str, exported_items:
Collection, file: Tex
print(f"{len(exported_items)} {command_type} successfully exported to
{file.name}.")
+def get_hidden_entries_warning(entity_name: str, env_prefix: str) -> str |
None:
+ """
+ Build a warning about entries this listing cannot show.
+
+ Connections and Variables can be defined in three places: the metadata
database, environment
+ variables, and an optional secrets backend. The database is checked last,
so an environment
+ variable or a secrets backend entry silently takes precedence over a
database row with the same
+ ID. Commands that only enumerate database rows (like ``connections list``
/ ``variables list``)
+ should surface that gap explicitly instead of presenting the database rows
as the full picture.
+
+ :param entity_name: Human-readable plural noun to use in the message, e.g.
``"connections"``.
+ :param env_prefix: Environment variable prefix used for this entity, e.g.
``AIRFLOW_CONN_``.
+ :return: A warning message, or ``None`` if neither hiding source appears
to be in use.
+ """
+ from airflow.configuration import conf
Review Comment:
Is the local conf import needed to avoid an import cycle or eager
configuration loading? Otherwise, could it be moved to the module imports?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]