Skip to content

Conversation

@sunank200
Copy link
Collaborator

Makes SQLAlchemy an optional dependency for the OpenLineage provider by adding it as an optional extra.

  • Wrapped sqlalchemy imports with try/except and raise AirflowOptionalProviderFeatureException when missing
  • Users who need SQL lineage features should install: pip install 'apache-airflow-providers-openlineage[sqlalchemy]'

closes: #59904


^ 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@sunank200 sunank200 force-pushed the make-sqlalchemy-optional-in-openlineage-provider branch from af00c19 to 2a69289 Compare December 30, 2025 08:26
@potiuk
Copy link
Member

potiuk commented Dec 30, 2025

Nice - few questions - but more to openlineage Airflow 3 integration :)

@kacpermuda
Copy link
Contributor

One more note, in utils.py we're also using some db methods like DagRun.fetch_task_instances here, but we only call it on scheduler. We're also going to add another call to db here for asset triggered dagruns, also performed only on scheduler. Not sure how this relates to treating sqlalchemy as optional.

@potiuk
Copy link
Member

potiuk commented Dec 30, 2025

One more note, in utils.py we're also using some db methods like DagRun.fetch_task_instances here, but we only call it on scheduler. We're also going to add another call to db here for asset triggered dagruns, also performed only on scheduler. Not sure how this relates to treating sqlalchemy as optional.

Not yet. This will come later when we will split (some) providers into two types of providers (maybe they won't be named like that) - we've been disussing it but deferred decision on that to after we complete task isolation and separated core and task-sdk. We iwll have to separate some distributions in two:

  • executors/ui plugins/scheduler listeners and plugins (installable with airflow-core)
  • Hooks/Operators/macro plugins etc. (installable with task-sdk)

This falls in the same part - part of the current openlineage provider should be a distribution installed with "task-sdk" and part should be another distribution installed with "airflow-core".

Later we can even split "airflow-ui" as separate distribution and have 3 types of "providers"

@sunank200 sunank200 force-pushed the make-sqlalchemy-optional-in-openlineage-provider branch from e6bccd9 to 72bd9cc Compare December 31, 2025 13:43
@sunank200 sunank200 marked this pull request as ready for review December 31, 2025 13:44
@potiuk
Copy link
Member

potiuk commented Dec 31, 2025

Nice!

@potiuk potiuk merged commit 22cb741 into apache:main Dec 31, 2025
99 checks passed
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Jan 2, 2026
…59921)

* Make sqlalchemy optional dependency for openlineage provider

* Refactor sqlalchemy imports to be lazy in openlineage utils

* The function is already guarded by 'if not AIRFLOW_V_3_0_PLUS:' so the
inner check for AIRFLOW_V_3_0_PLUS was unreachable dead code.

* Remove sqlalchemy-specific ImportError handling in get_openlineage_facets_with_sql
stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
…59921)

* Make sqlalchemy optional dependency for openlineage provider

* Refactor sqlalchemy imports to be lazy in openlineage utils

* The function is already guarded by 'if not AIRFLOW_V_3_0_PLUS:' so the
inner check for AIRFLOW_V_3_0_PLUS was unreachable dead code.

* Remove sqlalchemy-specific ImportError handling in get_openlineage_facets_with_sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add proper dependencies for sqlalchemy - openlineage

3 participants