You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/13 17:54:30 UTC
[GitHub] [airflow] kaxil commented on a diff in pull request #28246: Better table name validation for db clean
kaxil commented on code in PR #28246:
URL: https://github.com/apache/airflow/pull/28246#discussion_r1047526850
##########
airflow/utils/db_cleanup.py:
##########
@@ -337,8 +337,14 @@ def run_cleanup(
:param session: Session representing connection to the metadata database.
"""
clean_before_timestamp = timezone.coerce_datetime(clean_before_timestamp)
- effective_table_names = table_names if table_names else list(config_dict.keys())
- effective_config_dict = {k: v for k, v in config_dict.items() if k in effective_table_names}
+ desired_table_names = set(table_names if table_names else config_dict.keys())
+ effective_config_dict = {k: v for k, v in config_dict.items() if k in desired_table_names}
+ effective_table_names = set(effective_config_dict.keys())
+ if desired_table_names != effective_table_names:
+ outliers = desired_table_names - effective_table_names
+ logger.warning("The following table(s) are not valid choices and will be skipped: %s", outliers)
Review Comment:
We can probably add a unit test case for this
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org