You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using CASE in a select statement breaks the split_statements logic used for inferring lineage from stored procedures in mssql
To Reproduce
fromdatahub.sql_parsing.schema_resolverimportSchemaResolverfromdatahub.sql_parsing.split_statementsimportsplit_statementsfromdatahub.sql_parsing.sqlglot_lineageimportsqlglot_lineagesql_text="""SELECT Id, CASE WHEN Id > 10 THEN 'IS_GREATER_THAN_TEN' WHEN Id > 5 THEN 'IS_GREATER_THAN_FIVE' ELSE 'IS_SMALL' END AS foo, barFROM mySchema.myTable"""schema_resolver=SchemaResolver(platform="mssql")
statements=split_statements(sql_text)
results= []
forsinstatements:
print(s)
print("------")
parsed=sqlglot_lineage(
s,
schema_resolver=schema_resolver,
default_db="myDatabase",
default_schema="mySchema",
)
results.append(parsed)
forrinresults:
print(r.json(indent=4))
print("------")
The individual statements that are produced by split_statements are
SELECT
Id,
CASE
WHEN Id > 10 THEN 'IS_GREATER_THAN_TEN'
WHEN Id > 5 THEN 'IS_GREATER_THAN_FIVE'
ELSE 'IS_SMALL'
------
END
------
AS foo,
bar
FROM mySchema.myTable
------
Expected behavior
The statement should not be broken up, such that the SELECT part can be parsed correctly and lineage can be inferred.
Additional context
acryl-datahub python package version is 0.15.0.5
The text was updated successfully, but these errors were encountered:
Describe the bug
Using
CASE
in a select statement breaks thesplit_statements
logic used for inferring lineage from stored procedures in mssqlTo Reproduce
The individual statements that are produced by
split_statements
areExpected behavior
The statement should not be broken up, such that the SELECT part can be parsed correctly and lineage can be inferred.
Additional context
acryl-datahub python package version is
0.15.0.5
The text was updated successfully, but these errors were encountered: