ISSUE-20427: fix tableau ingestion for null upstream table queries (#20428)

For tableau ingestion, code does not handle properly null upstream custom table queries
and null values for table OM entities.

Co-authored-by: Abdallah Serghine <abdallah.serghine@olx.pl>
Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com>
This commit is contained in:
Abdallah Serghine 2025-04-02 11:53:30 +02:00 committed by GitHub
parent 75f1dd9f64
commit 2e0822b830
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -895,6 +895,7 @@ class TableauSource(DashboardServiceSource):
[
TableAndQuery(table=table, query=custom_sql_table.query)
for table in from_entities
if table is not None
]
)

View File

@ -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