Skip to content

Commit

Permalink
normalize kind
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 committed Feb 6, 2024
1 parent ffad682 commit 7c16911
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions metadata-ingestion/src/datahub/sql_parsing/sqlglot_lineage.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def get_query_type_of_sql(

kind = expression.args.get("kind")
if kind:
kind = kind.upper()
query_type_props["kind"] = kind

target = expression.this
Expand All @@ -101,9 +102,9 @@ def get_query_type_of_sql(
) or _is_temp_table(target, dialect=dialect):
query_type_props["temporary"] = True

if kind and "TABLE" in kind.upper():
if kind and "TABLE" in kind:
return QueryType.CREATE_TABLE_AS_SELECT, query_type_props
elif kind and "VIEW" in kind.upper():
elif kind and "VIEW" in kind:
return QueryType.CREATE_VIEW, query_type_props

return QueryType.CREATE_OTHER, query_type_props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"query_type": "MERGE",
"query_type_props": {},
"query_fingerprint": "8001b852498d94a7f0f532dcd8cfa05328981ba437df6314466c764cc408969c",
"query_fingerprint": "d6631edda99334cff011305d30c423f01d996185372c2aec6bb3e82e185fcad0",
"in_tables": [
"urn:li:dataset:(urn:li:dataPlatform:bigquery,demo-pipelines-stg.referrer.prep_from_ios,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:bigquery,demo-pipelines-stg.referrer.prep_from_web,PROD)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"query_type_props": {
"kind": "TABLE"
},
"query_fingerprint": "2aa655ab211e061dc8c1161e0b2a7073b38636f9ffcc4719d4e70743e3321cb2",
"query_fingerprint": "7ec7291bc95ab8e4978f86f3854336100aadca5143b79cfd92edbd5f245af916",
"in_tables": [
"urn:li:dataset:(urn:li:dataPlatform:snowflake,long_tail_companions.analytics.customer_last_purchase_date,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,long_tail_companions.ecommerce.purchases,PROD)"
Expand Down

0 comments on commit 7c16911

Please sign in to comment.