Repository navigation
Detect Tableau BACKFILL_RUNNING errors and abort ingestion when markDeletedDashboards is enabled#25032
Conversation
- Add TableauBackfillRunningException to handle backfill errors - Add _check_backfill_running_error() method to detect errors in GraphQL responses - Integrate error checking into _query_datasources() and cache_custom_sql_tables() - Pass markDeletedDashboards config to TableauClient - Raise exception when BACKFILL_RUNNING detected with markDeletedDashboards=True - Log warning when BACKFILL_RUNNING detected with markDeletedDashboards=False - Add comprehensive unit tests for BACKFILL_RUNNING detection Co-authored-by: ulixius9 <[email protected]>
…uotes Co-authored-by: ulixius9 <[email protected]>
Code Review 👍 Approved with suggestions 0 resolved / 2 findingsGood defensive feature to prevent incorrect metadata deletion during Tableau backfill, with minor initialization and coverage concerns.
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
| self.today = datetime.now().strftime("%Y-%m-%d") | ||
| # Pass markDeletedDashboards config to the client |
There was a problem hiding this comment.
⚠️ Edge Case: Initialization timing issue with mark_deleted_dashboards
The mark_deleted_dashboards attribute is set after super().__init__() is called, but the client is created in the parent class's __init__. This means the client may already be created with the default value (False) before this code executes.
While the current implementation works because the attribute is checked at runtime during GraphQL calls (not at construction time), this is fragile and unintuitive. If the parent's __init__ were to make GraphQL calls, the flag would still be False.
Suggested fix: Pass mark_deleted_dashboards during client construction in the parent class, or ensure the create() method provides the parameter when constructing the client. This would make the configuration flow clearer and more robust.
Was this helpful? React with 👍 / 👎
| workbook_id=dashboard_id, first=entities_per_page, offset=offset | ||
| ) | ||
| ) | ||
|
|
||
| # Check for BACKFILL_RUNNING error in GraphQL response | ||
| self._check_backfill_running_error(datasources_graphql_result) | ||
|
|
There was a problem hiding this comment.
💡 Edge Case: BACKFILL_RUNNING check only added to 2 GraphQL methods
The _check_backfill_running_error() check is only added to get_all_datasources and the custom SQL tables query method. However, if the Tableau client has other methods that make GraphQL queries (e.g., queries for workbooks, sheets, or other metadata), those would not have this protection.
If Tableau returns BACKFILL_RUNNING for any GraphQL query, incomplete data could still be processed in other methods.
Suggestion: Audit all GraphQL query methods in the client to ensure consistent backfill error checking, or consider creating a wrapper method for GraphQL execution that automatically includes this check.
Was this helpful? React with 👍 / 👎
Describe your changes:
During Tableau's quarterly metadata backfill (which can last up to a week), GraphQL queries return incomplete data with
code: "BACKFILL_RUNNING". Running ingestion withmarkDeletedDashboards: trueduring this period causes valid dashboards and data models to be incorrectly marked as deleted, breaking lineage and losing metadata.Changes:
TableauBackfillRunningException- New exception class for backfill state detection_check_backfill_running_error()- Inspects GraphQL responses for BACKFILL_RUNNING error code inextensions.code_query_datasources()andcache_custom_sql_tables()GraphQL query methodsmarkDeletedDashboards=true: Raises exception, aborts ingestion with clear error messagemarkDeletedDashboards=false: Logs warning, continues with incomplete dataTableauSource.__init__to propagatemarkDeletedDashboardssetting to clientExample GraphQL response with BACKFILL_RUNNING:
{ "errors": [ { "message": "Still creating the Metadata API Store. Results might be incomplete.", "extensions": { "severity": "WARNING", "code": "BACKFILL_RUNNING" } } ], "data": { "workbooks": [] } }Result:
Type of change:
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.