mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +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
|
from metadata.utils.logger import ingestion_logger
|
||||||
|
|
||||||
logger = ingestion_logger()
|
logger = ingestion_logger()
|
||||||
|
QUERY_WITH_OM_VERSION = '/* {"app": "OpenMetadata"'
|
||||||
|
QUERY_WITH_DBT = '/* {"app": "dbt"'
|
||||||
|
|
||||||
|
|
||||||
class DatabricksClient:
|
class DatabricksClient:
|
||||||
@ -113,3 +115,10 @@ class DatabricksClient:
|
|||||||
logger.error(exc)
|
logger.error(exc)
|
||||||
|
|
||||||
return query_details
|
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:
|
for row in data:
|
||||||
try:
|
try:
|
||||||
|
if self.client.is_query_valid(row):
|
||||||
yield TableQuery(
|
yield TableQuery(
|
||||||
query=row.get("query_text"),
|
query=row.get("query_text"),
|
||||||
userName=row.get("user_name"),
|
userName=row.get("user_name"),
|
||||||
|
@ -93,6 +93,7 @@ class DatabricksUsageSource(DatabricksQueryParserSource, UsageSource):
|
|||||||
)
|
)
|
||||||
for row in data:
|
for row in data:
|
||||||
try:
|
try:
|
||||||
|
if self.client.is_query_valid(row):
|
||||||
queries.append(
|
queries.append(
|
||||||
TableQuery(
|
TableQuery(
|
||||||
query=row.get("query_text"),
|
query=row.get("query_text"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user