diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py index ef1337a8d6f..7b4b18034d1 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py @@ -859,6 +859,7 @@ class TableauSource(DashboardServiceSource): [ TableAndQuery(table=table, query=custom_sql_table.query) for table in from_entities + if table is not None ] ) diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py index 9c56ce9e673..26b522768c8 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py @@ -144,6 +144,14 @@ class UpstreamTable(BaseModel): database: Optional[TableauDatabase] = None referencedByQueries: Optional[List[CustomSQLTable]] = None + @validator("referencedByQueries", pre=True) + @classmethod + def filter_none_queries(cls, v): + """Filter out CustomSQLTable items where query==None.""" + if v is None: + return None + return [item for item in v if item.get("query") is not None] + class DataSource(BaseModel): id: str