Skip to content

Commit

Permalink
Remove sqlalchemy-redshift dependency (#43271)
Browse files Browse the repository at this point in the history
* Remove sqlalchemy-redshift dependency from Amazon provider

`sqlalchemy-redshift` is unused. It is also not compatible with sqlalchemy>2, so good riddance!

* move redshift hook to use postgres connector

Signed-off-by: Maciej Obuchowski <[email protected]>

---------

Signed-off-by: Maciej Obuchowski <[email protected]>
Co-authored-by: Ash Berlin-Taylor <[email protected]>
  • Loading branch information
mobuchowski and ashb authored Oct 23, 2024
1 parent 0c4ed7a commit 6786032
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow"
# NOTE! When you want to make sure dependencies are installed from scratch in your PR after removing
# some dependencies, you also need to set "disable image cache" in your PR to make sure the image is
# not built using the "main" version of those dependencies.
ARG DEPENDENCIES_EPOCH_NUMBER="11"
ARG DEPENDENCIES_EPOCH_NUMBER="12"

# Make sure noninteractive debian install is used and language variables set
ENV PYTHON_BASE_IMAGE=${PYTHON_BASE_IMAGE} \
Expand Down
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 @@ -548,7 +548,7 @@ def get_airflow_extras():
# END OF EXTRAS LIST UPDATED BY PRE COMMIT
]

CHICKEN_EGG_PROVIDERS = " ".join(["standard"])
CHICKEN_EGG_PROVIDERS = " ".join(["standard amazon"])


BASE_PROVIDERS_COMPATIBILITY_CHECKS: list[dict[str, str | list[str]]] = [
Expand Down
1 change: 0 additions & 1 deletion generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"jsonpath_ng>=1.5.3",
"python3-saml>=1.16.0",
"redshift_connector>=2.0.918",
"sqlalchemy_redshift>=0.8.6",
"watchtower>=3.0.0,!=3.3.0,<4"
],
"devel-deps": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_uri(self) -> str:
# Compatibility: The 'create' factory method was added in SQLAlchemy 1.4
# to replace calling the default URL constructor directly.
create_url = getattr(URL, "create", URL)
return str(create_url(drivername="redshift+redshift_connector", **conn_params))
return str(create_url(drivername="postgresql", **conn_params))

def get_sqlalchemy_engine(self, engine_kwargs=None):
"""Overridden to pass Redshift-specific arguments."""
Expand Down
1 change: 0 additions & 1 deletion providers/src/airflow/providers/amazon/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ dependencies:
- watchtower>=3.0.0,!=3.3.0,<4
- jsonpath_ng>=1.5.3
- redshift_connector>=2.0.918
- sqlalchemy_redshift>=0.8.6
- asgiref>=2.3.0
- PyAthena>=3.0.10
- jmespath>=0.7.0
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/amazon/aws/hooks/test_redshift_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setup_method(self):
self.db_hook.get_connection.return_value = self.connection

def test_get_uri(self):
expected = "redshift+redshift_connector://login:password@host:5439/dev"
expected = "postgresql://login:password@host:5439/dev"
x = self.db_hook.get_uri()
assert x == expected

Expand Down

0 comments on commit 6786032

Please sign in to comment.