mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 07:23:39 +00:00
Improve filtering for lineage query (#11457)
This commit is contained in:
parent
9d61d63ce4
commit
a897954afc
@ -27,5 +27,8 @@ class BigqueryLineageSource(BigqueryQueryParserSource, LineageSource):
|
||||
sql_stmt = BIGQUERY_STATEMENT
|
||||
|
||||
filters = """
|
||||
AND statement_type IN ("INSERT", "MERGE", "CREATE_TABLE_AS_SELECT", "UPDATE")
|
||||
AND (
|
||||
statement_type IN ("MERGE", "CREATE_TABLE_AS_SELECT", "UPDATE")
|
||||
OR (statement_type = "INSERT" and UPPER(query) like '%%INSERT%%INTO%%SELECT%%')
|
||||
)
|
||||
"""
|
||||
|
||||
@ -29,7 +29,10 @@ class ClickhouseLineageSource(ClickhouseQueryParserSource, LineageSource):
|
||||
sql_stmt = CLICKHOUSE_SQL_STATEMENT
|
||||
|
||||
filters = """
|
||||
and query_kind in ('Create', 'Insert')
|
||||
and (
|
||||
query_kind='Create'
|
||||
or (query_kind='Insert' and query ilike '%%insert%%into%%select%%')
|
||||
)
|
||||
"""
|
||||
|
||||
database_field = ""
|
||||
|
||||
@ -19,4 +19,11 @@ from metadata.ingestion.source.database.mssql.query_parser import MssqlQueryPars
|
||||
class MssqlLineageSource(MssqlQueryParserSource, LineageSource):
|
||||
sql_stmt = MSSQL_SQL_STATEMENT
|
||||
|
||||
filters = "" # No filtering in the queries
|
||||
filters = """
|
||||
AND (
|
||||
lower(t.text) LIKE '%%select%%into%%'
|
||||
OR lower(t.text) LIKE '%%insert%%into%%select%%'
|
||||
OR lower(t.text) LIKE '%%update%%'
|
||||
OR lower(t.text) LIKE '%%merge%%'
|
||||
)
|
||||
"""
|
||||
|
||||
@ -34,7 +34,9 @@ class PostgresLineageSource(PostgresQueryParserSource, LineageSource):
|
||||
filters = """
|
||||
AND (
|
||||
s.query ILIKE '%%create table%%as%%select%%'
|
||||
OR s.query ILIKE '%%insert%%'
|
||||
OR s.query ILIKE '%%insert%%into%%select%%'
|
||||
OR s.query ILIKE '%%update%%'
|
||||
OR s.query ILIKE '%%merge%%'
|
||||
)
|
||||
"""
|
||||
|
||||
|
||||
@ -40,8 +40,10 @@ from metadata.ingestion.source.database.redshift.query_parser import (
|
||||
class RedshiftLineageSource(RedshiftQueryParserSource, LineageSource):
|
||||
filters = """
|
||||
AND (
|
||||
querytxt ILIKE '%%create table%%as%%select%%'
|
||||
OR querytxt ILIKE '%%insert%%'
|
||||
querytxt ILIKE '%%create%%table%%as%%select%%'
|
||||
OR querytxt ILIKE '%%insert%%into%%select%%'
|
||||
OR querytxt ILIKE '%%update%%'
|
||||
OR querytxt ILIKE '%%merge%%'
|
||||
)
|
||||
"""
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@ class RedshiftUsageSource(RedshiftQueryParserSource, UsageSource):
|
||||
filters = """
|
||||
AND querytxt NOT ILIKE 'fetch%%'
|
||||
AND querytxt NOT ILIKE 'padb_fetch_sample:%%'
|
||||
AND querytxt NOT ILIKE 'Undoing %% transactions on table %% with current xid%%'
|
||||
AND querytxt NOT ILIKE '%%create table%%as%%select%%'
|
||||
AND querytxt NOT ILIKE 'Undoing%%transactions%%on%%table%%with%%current%%xid%%'
|
||||
AND querytxt NOT ILIKE '%%create%%table%%as%%select%%'
|
||||
AND querytxt NOT ILIKE '%%insert%%'
|
||||
"""
|
||||
|
||||
|
||||
@ -27,5 +27,8 @@ class SnowflakeLineageSource(SnowflakeQueryParserSource, LineageSource):
|
||||
sql_stmt = SNOWFLAKE_SQL_STATEMENT
|
||||
|
||||
filters = """
|
||||
AND QUERY_TYPE IN ('INSERT', 'MERGE', 'UPDATE','CREATE_TABLE_AS_SELECT')
|
||||
AND (
|
||||
QUERY_TYPE IN ('MERGE', 'UPDATE','CREATE_TABLE_AS_SELECT')
|
||||
OR (QUERY_TYPE = 'INSERT' and query_text ILIKE '%%insert%%into%%select%%')
|
||||
)
|
||||
"""
|
||||
|
||||
@ -24,7 +24,13 @@ logger = ingestion_logger()
|
||||
class VerticaLineageSource(VerticaQueryParserSource, LineageSource):
|
||||
sql_stmt = VERTICA_SQL_STATEMENT
|
||||
|
||||
filters = "AND query_type in ('INSERT', 'UPDATE', 'QUERY', 'DDL')"
|
||||
filters = """
|
||||
AND (
|
||||
query_type in ('UPDATE', 'DDL')
|
||||
OR ( query_type IN ('INSERT','QUERY') and p.query ilike '%%INSERT%%INTO%%SELECT%%')
|
||||
OR ( query_type = 'QUERY' and p.query not ilike '%%INSERT%%INTO%%')
|
||||
)
|
||||
"""
|
||||
|
||||
database_field = "DBNAME()"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user