Skip to content

Commit

Permalink
Remove unnecessary compatibility code in S3 asset import
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Dec 6, 2024
1 parent 98e0977 commit 148f0a9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dev/breeze/src/airflow_breeze/global_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def get_airflow_extras():
# END OF EXTRAS LIST UPDATED BY PRE COMMIT
]

CHICKEN_EGG_PROVIDERS = " ".join(["standard amazon common.sql"])
CHICKEN_EGG_PROVIDERS = " ".join(["common.compat"])


PROVIDERS_COMPATIBILITY_TESTS_MATRIX: list[dict[str, str | list[str]]] = [
Expand Down
2 changes: 1 addition & 1 deletion generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"amazon": {
"deps": [
"PyAthena>=3.0.10",
"apache-airflow-providers-common-compat>=1.2.1",
"apache-airflow-providers-common-compat>=1.3.0",
"apache-airflow-providers-common-sql>=1.20.0",
"apache-airflow-providers-http",
"apache-airflow>=2.8.0",
Expand Down
18 changes: 1 addition & 17 deletions providers/src/airflow/providers/amazon/aws/assets/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,14 @@
from typing import TYPE_CHECKING

from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.providers.common.compat.assets import Asset

if TYPE_CHECKING:
from urllib.parse import SplitResult

from airflow.providers.common.compat.assets import Asset
from airflow.providers.common.compat.openlineage.facet import (
Dataset as OpenLineageDataset,
)
else:
# TODO: Remove this try-exception block after bumping common provider to 1.3.0
# This is due to common provider AssetDetails import error handling
try:
from airflow.providers.common.compat.assets import Asset
except ImportError:
from packaging.version import Version

from airflow import __version__ as AIRFLOW_VERSION

AIRFLOW_V_3_0_PLUS = Version(Version(AIRFLOW_VERSION).base_version) >= Version("3.0.0")
if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.definitions.asset import Asset
else:
# dataset is renamed to asset since Airflow 3.0
from airflow.datasets import Dataset as Asset


def create_asset(*, bucket: str, key: str, extra=None) -> Asset:
Expand Down
2 changes: 1 addition & 1 deletion providers/src/airflow/providers/amazon/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ versions:

dependencies:
- apache-airflow>=2.8.0
- apache-airflow-providers-common-compat>=1.2.1
- apache-airflow-providers-common-compat>=1.3.0
- apache-airflow-providers-common-sql>=1.20.0
- apache-airflow-providers-http
# We should update minimum version of boto3 and here regularly to avoid `pip` backtracking with the number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ state: ready
source-date-epoch: 1731569875
# note that those versions are maintained by release manager - do not update them manually
versions:
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
Expand Down

0 comments on commit 148f0a9

Please sign in to comment.