Skip to content

openlineage: improve how sql utils parse table schemas #35552

Description

@JDarDagran

Apache Airflow version

main (development)

What happened

For SQL based operators there is airflow.providers.openlineage.utils.sql module used by SQLParser interface class.
In short: it allows to parse table schemas based on input and output dataset parsed from SQL query.

What you think should happen instead

It should take into consideration if there is database/schema from connection setup detected from information schema query result. If there is one found it should stop adding other tables.

How to reproduce

Corner case is following:

  1. use database connection with database and/or schema default set
  2. refer to table name only in SQL query (e.g. SELECT * FROM my_table instead of SELECT * FROM my_schema.my_table)
  3. if there's the same table name in other database/schema (or database+schema combination, it depends on database) OL integration will produce two datasets for tables.
    For instance if one uses postgres with search path set to public schema SELECT * FROM my_table would get data from public.my_table even if there is another table with the same name but different schema. OL integration will take both my_schema.my_table and public.my_table.

Operating System

macOS

Versions of Apache Airflow Providers

apache-airflow-providers-openlineage==1.2.0

Deployment

Other Docker-based deployment

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on Nov 9, 2023

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. potiuk commented on Nov 9, 2023

    @potiuk
    Member

    Good ideas!

  3. added
    kind:taskA task that needs to be completed as part of a larger issue
    and removed
    kind:bugThis is a clearly a bug
    needs-triagelabel for new issues that we didn't triage yet
    on Jan 16, 2024
  4. IvanPiatnishin commented on Apr 2, 2025

    @IvanPiatnishin

    I'd like to work on this issue. Can you assign it to me?

  5. added
    kind:bugThis is a clearly a bug
    and removed
    kind:taskA task that needs to be completed as part of a larger issue
    on Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions