mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
Fix: ignored query with om-version and dbt (#8851)
* Fix: ignored query with om-version and dbt * Change based on comments
This commit is contained in:
parent
2c055641be
commit
bc215515d8
@ -25,6 +25,8 @@ from metadata.utils.helpers import datetime_to_ts
|
||||
from metadata.utils.logger import ingestion_logger
|
||||
|
||||
logger = ingestion_logger()
|
||||
QUERY_WITH_OM_VERSION = '/* {"app": "OpenMetadata"'
|
||||
QUERY_WITH_DBT = '/* {"app": "dbt"'
|
||||
|
||||
|
||||
class DatabricksClient:
|
||||
@ -113,3 +115,10 @@ class DatabricksClient:
|
||||
logger.error(exc)
|
||||
|
||||
return query_details
|
||||
|
||||
def is_query_valid(self, row) -> bool:
|
||||
query_text = row.get("query_text")
|
||||
return not (
|
||||
query_text.startswith(QUERY_WITH_DBT)
|
||||
or query_text.startswith(QUERY_WITH_OM_VERSION)
|
||||
)
|
||||
|
@ -63,6 +63,7 @@ class DatabricksLineageSource(DatabricksQueryParserSource, LineageSource):
|
||||
)
|
||||
for row in data:
|
||||
try:
|
||||
if self.client.is_query_valid(row):
|
||||
yield TableQuery(
|
||||
query=row.get("query_text"),
|
||||
userName=row.get("user_name"),
|
||||
|
@ -93,6 +93,7 @@ class DatabricksUsageSource(DatabricksQueryParserSource, UsageSource):
|
||||
)
|
||||
for row in data:
|
||||
try:
|
||||
if self.client.is_query_valid(row):
|
||||
queries.append(
|
||||
TableQuery(
|
||||
query=row.get("query_text"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user