-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Made sqlalchemy dependency optional for amazon provider #59941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| try: | ||
| from sqlalchemy.engine.url import URL | ||
| except ImportError: | ||
| URL = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@potiuk Please note before approving similar PRs that leaving URL untyped (i.e. URL: Any before the try block) or unignored (# type: ignore[assignment,misc]) leads to mypy violations on SQLA2:
providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_sql.py:30: error: Cannot assign to a type [misc]
URL = create_engine = None
^~~
providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_sql.py:30: error: Incompatible types in assignment (expression has
type "None", variable has type "type[URL]") [assignment]
URL = create_engine = None
^
providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_sql.py:30: error: Incompatible types in assignment (expression has
type "None", variable has type overloaded function) [assignment]
URL = create_engine = None
^~~~
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py:28: error: Cannot assign to a type [misc]
URL = None
^~~
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py:28: error: Incompatible types in assignment (expression has type
"None", variable has type "type[URL]") [assignment]
URL = None
^~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. That's unfortunate indeed
* Made sqlalchemy dependency optional for amazon provider * Prek formatting
* Made sqlalchemy dependency optional for amazon provider * Prek formatting
* Made sqlalchemy dependency optional for amazon provider * Prek formatting
* Made sqlalchemy dependency optional for amazon provider * Prek formatting
closes: #59896
Made SQLAlchemy an optional dependency for the Amazon provider. The imports are now wrapped with try/except and
AirflowOptionalProviderFeatureException()gets raised if it is not installed.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.