From 8e005ab1622c9499d13823a97bfdb41eb1684627 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 12 Nov 2024 18:52:52 +0800 Subject: [PATCH] Remove strict_asset_uri_validation (#43915) --- airflow/assets/__init__.py | 17 +---------------- airflow/config_templates/config.yml | 7 ------- newsfragments/41348.significant.rst | 2 +- newsfragments/43915.significant.rst | 4 ++++ 4 files changed, 6 insertions(+), 24 deletions(-) create mode 100644 newsfragments/43915.significant.rst diff --git a/airflow/assets/__init__.py b/airflow/assets/__init__.py index 58256929948a8..59e0b86684493 100644 --- a/airflow/assets/__init__.py +++ b/airflow/assets/__init__.py @@ -36,9 +36,6 @@ from sqlalchemy.orm.session import Session - -from airflow.configuration import conf - __all__ = ["Asset", "AssetAll", "AssetAny", "Dataset"] @@ -104,19 +101,7 @@ def _sanitize_uri(uri: str) -> str: fragment="", # Ignore any fragments. ) if (normalizer := _get_uri_normalizer(normalized_scheme)) is not None: - try: - parsed = normalizer(parsed) - except ValueError as exception: - if conf.getboolean("core", "strict_asset_uri_validation", fallback=True): - log.error( - ( - "The Asset URI %s is not AIP-60 compliant: %s. " - "Please check https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/assets.html" - ), - uri, - exception, - ) - raise + parsed = normalizer(parsed) return urllib.parse.urlunsplit(parsed) diff --git a/airflow/config_templates/config.yml b/airflow/config_templates/config.yml index 25efa9ba77f34..4d58de3c37e28 100644 --- a/airflow/config_templates/config.yml +++ b/airflow/config_templates/config.yml @@ -482,13 +482,6 @@ core: sensitive: true default: ~ example: '{"some_param": "some_value"}' - strict_asset_uri_validation: - description: | - Asset URI validation should raise an exception if it is not compliant with AIP-60. - default: "True" - example: ~ - version_added: 2.9.2 - type: boolean database_access_isolation: description: (experimental) Whether components should use Airflow Internal API for DB connectivity. version_added: 2.6.0 diff --git a/newsfragments/41348.significant.rst b/newsfragments/41348.significant.rst index 8b5cc54dd40dc..eeda04d3985cd 100644 --- a/newsfragments/41348.significant.rst +++ b/newsfragments/41348.significant.rst @@ -187,7 +187,7 @@ * Rename function ``has_access_dataset`` as ``has_access_asset`` -* Rename configuration ``core.strict_dataset_uri_validation`` as ``core.strict_asset_uri_validation``, ``core.dataset_manager_class`` as ``core.asset_manager_class`` and ``core.dataset_manager_class`` as ``core.asset_manager_class`` +* Rename configuration ``core.dataset_manager_class`` as ``core.asset_manager_class`` and ``core.dataset_manager_class`` as ``core.asset_manager_class`` * Rename example dags ``example_dataset_alias.py``, ``example_dataset_alias_with_no_taskflow.py``, ``example_datasets.py`` as ``example_asset_alias.py``, ``example_asset_alias_with_no_taskflow.py``, ``example_assets.py`` * Rename DagDependency name ``dataset-alias``, ``dataset`` as ``asset-alias``, ``asset`` * Rename context key ``triggering_dataset_events`` as ``triggering_asset_events`` diff --git a/newsfragments/43915.significant.rst b/newsfragments/43915.significant.rst new file mode 100644 index 0000000000000..efcc48f116b0e --- /dev/null +++ b/newsfragments/43915.significant.rst @@ -0,0 +1,4 @@ +Configuration ``[core] strict_dataset_uri_validation`` is removed + +Asset URI with a defined scheme will now always be validated strictly, raising +a hard error on validation failure.