Skip to content
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

Column names in quotes not parsed in subqueries #654

Open
teabbs opened this issue Oct 7, 2024 · 1 comment
Open

Column names in quotes not parsed in subqueries #654

teabbs opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@teabbs
Copy link

teabbs commented Oct 7, 2024

Describe the bug
If column names and aliases in subqueries are specified in double quotes, they are not traced to table names.
We use Orable DB with sqlalchemy metadata connection.

SQL
Paste the SQL text here. For example:

INSERT INTO ODS.KLIENT (
SELECT
 "Номер договора" NomerDogovora,
 "ФИО клиента" FioKlienta,
 "Продукт" Produkt
FROM (
 SELECT
  T.Fld1234 "Номер договора",
  T.Fld1235 "ФИО клиента",
  T.Fld1236 "Продукт"
 FROM ODS.DOGOVOR T))

To Reproduce
Run sqllineage with this test.sql

  • if CLI (Command Line Interface): provide the command you're calling and the output.
sqllineage -f test.sql -l column --dialect=oracle --sqlalchemy_url=oracle+cx_oracle://....

And the result has only "subquery_013241345413.номер договора" etc, and not the original table.

Expected behavior
The result has the original Fld... columns and the original ODS.DOGOVOR table name.

Python version (available via python --version)

  • 3.9.19
  • 3.11.2

SQLLineage version (available via sqllineage --version):

  • 1.5.3
@teabbs teabbs added the bug Something isn't working label Oct 7, 2024
@reata
Copy link
Owner

reata commented Feb 7, 2025

This is an interesting bug in how we handle case.

I changed the Bulgarian (Google Translate told me so, let me know if it's not) to English to make it for a bit more friendly. And it's nothing special with Oracle or metadata. All following cases can be invoked via

sqllineage -f test.sql -l column

Working test case:

INSERT INTO ODS.KLIENT (
SELECT
 "ABC" NomerDogovora
FROM (
 SELECT
  T.Fld1234 "abc"
 FROM ODS.DOGOVOR T))
ods.klient.nomerdogovora <- subquery_4606699020165380082.abc <- ods.dogovor.fld1234

Also working test case:

INSERT INTO ODS.KLIENT (
SELECT
 ABC NomerDogovora
FROM (
 SELECT
  T.Fld1234 "abc"
 FROM ODS.DOGOVOR T))
ods.klient.nomerdogovora <- subquery_4606699020165380082.abc <- ods.dogovor.fld1234

NOT working test case:

INSERT INTO ODS.KLIENT (
SELECT
 "abc" NomerDogovora
FROM (
 SELECT
  T.Fld1234 "ABC"
 FROM ODS.DOGOVOR T))
ods.klient.nomerdogovora <- subquery_2999567446547683174.abc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants