|
| 1 | +--- |
| 2 | +name: datalineage-bigquery-asset-impact-analysis |
| 3 | +description: >- |
| 4 | + Performs a deep impact analysis for a broken, stale, or modified BigQuery data asset. |
| 5 | + Identifies all downstream tables, dashboards, and processes that will be affected (the blast radius). |
| 6 | +--- |
| 7 | + |
| 8 | +# BigQuery Asset Impact Analysis |
| 9 | + |
| 10 | +This skill guides the agent in performing a downstream impact analysis (blast |
| 11 | +radius assessment) when a BigQuery table or view is reported as broken, stale, |
| 12 | +missing, or when a user is planning maintenance and wants to know the |
| 13 | +consequences of modifying or pausing updates to an asset. |
| 14 | + |
| 15 | +It relies primarily on the **Google Cloud Data Lineage (Dataplex) MCP Server** |
| 16 | +to discover relationships between assets. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +This skill requires access to the Google Cloud Data Lineage API and an active |
| 21 | +client connection to the Data Lineage MCP Server. For detailed connection |
| 22 | +configurations and tool schemas, refer to [MCP Usage](references/mcp-usage.md). |
| 23 | + |
| 24 | +## Analysis Workflow |
| 25 | + |
| 26 | +### 1. Resolve the Asset Fully Qualified Name (FQN) |
| 27 | + |
| 28 | +* Ensure you have the correct FQN format for the BigQuery asset: |
| 29 | + * *Format:* `bigquery:{project_id}.{dataset_id}.{table_or_view_id}` |
| 30 | + * *Example:* `bigquery:my-prod-project.analytics.orders` |
| 31 | +* If the user provides a partial path (e.g., just `dataset.table`), attempt to |
| 32 | + infer the active project from the environment or ask the user for |
| 33 | + clarification. |
| 34 | + |
| 35 | +### 2. Determine Locations and Parent Path |
| 36 | + |
| 37 | +Identify the locations to search and construct the Data Lineage API request: |
| 38 | + |
| 39 | +* **Discover Asset Location**: Run the command `bq show --format=json |
| 40 | + {project_id}:{dataset_id}` and extract the `location` field (e.g., |
| 41 | + `us-central1` or `us`). If location discovery fails due to permissions or |
| 42 | + missing tools, prompt the user for the dataset's location. |
| 43 | +* **Set Parent Path**: Set the `parent` path to match the location where your |
| 44 | + Data Lineage MCP server is configured (e.g., |
| 45 | + `projects/{project_id}/locations/{mcp_server_location}`). |
| 46 | +* **Configure Search Scope**: Include the discovered asset location in the |
| 47 | + `locations` array of the payload (e.g., `["us-central1"]` or `["us", |
| 48 | + "us-central1"]`). |
| 49 | + |
| 50 | +### 3. Retrieve the Downstream Lineage Graph |
| 51 | + |
| 52 | +Call the `DataLineageServer:search_lineage` tool to fetch downstream |
| 53 | +relationships. |
| 54 | + |
| 55 | +* **Direction**: Set to `DOWNSTREAM`. |
| 56 | +* **Search Parameters**: Use `max_depth = 10` and `max_process_per_link = 5` |
| 57 | + as robust defaults. |
| 58 | + |
| 59 | +### 4. Identify the Blast Radius |
| 60 | + |
| 61 | +Traverse the returned lineage links to build the impact graph: |
| 62 | + |
| 63 | +* **Affected Assets**: The `target` of each link represents a downstream asset |
| 64 | + that depends on your source asset. |
| 65 | +* **Transform Processes**: Inspect the `processes` field on each link. This |
| 66 | + identifies the ETL pipelines, BigQuery Views, or Scheduled Queries that |
| 67 | + propagate the data. |
| 68 | +* **Direct vs. Indirect Impact**: |
| 69 | + * **Direct Impact (Depth 1)**: Assets directly consuming the source asset. |
| 70 | + If a link has `dependency_type: EXACT_COPY`, mark the target as |
| 71 | + "Directly Stale / Identical Copy". |
| 72 | + * **Indirect Impact (Depth > 1)**: Assets further down the stream that |
| 73 | + will experience cascading stale data or failures. |
| 74 | + |
| 75 | +### 5. Summarize and Format the Output |
| 76 | + |
| 77 | +Present your findings clearly to the user using the following structure: |
| 78 | + |
| 79 | +1. **Executive Summary**: State the total number of downstream assets affected |
| 80 | + and the maximum depth of the impact. |
| 81 | +2. **Critical Path**: Highlight high-priority downstream assets (e.g., assets |
| 82 | + containing "prod", "dashboard", "reporting", or "master" in their names). |
| 83 | +3. **Blast Radius Table**: A clean markdown table listing the dependencies. You |
| 84 | + MUST include all columns: | Downstream Asset | Transform Process | Depth | |
| 85 | + Impact Type | | :--- | :--- | :--- | :--- | | |
| 86 | + `bigquery:project.dataset.table` | `projects/p/locations/l/processes/proc` | |
| 87 | + 1 | Direct | | `bigquery:project.dataset.view` | |
| 88 | + `projects/p/locations/l/processes/view` | 2 | Indirect | |
| 89 | +4. **Analysis Metadata**: Provide transparency on the parameters and boundaries |
| 90 | + of your search so the user can choose to expand them: |
| 91 | + * **Locations Searched**: `{list_of_locations_queried}` |
| 92 | + * **Parent Location**: `{parent_path}` |
| 93 | + * **Depth Limit**: `{max_depth}` |
| 94 | + * **Process per Link Limit**: `{max_process_per_link}` |
| 95 | + * *Tip for User*: Let the user know they can request to rerun the analysis |
| 96 | + with expanded locations or larger depth limits. |
| 97 | + |
| 98 | +## Crucial Constraints & Guardrails |
| 99 | + |
| 100 | +1. **Interpret Empty Responses Correctly**: |
| 101 | + * An empty response from `search_lineage` indicates that no lineage links |
| 102 | + are currently recorded for this asset in the queried locations. Do not |
| 103 | + assume the tool is broken or delayed; report the lack of dependencies |
| 104 | + clearly and proceed. |
| 105 | +2. **Strictly Banned Bypasses**: |
| 106 | + * Always use the `DataLineageServer:search_lineage` MCP tool. Avoid |
| 107 | + attempting fallback queries using `gcloud alpha datalineage` or raw |
| 108 | + `curl` API calls, as these will fail in the agent sandbox due to |
| 109 | + authentication and mTLS restrictions. |
| 110 | +3. **Verify Asset Existence First**: |
| 111 | + * If `bq show` indicates the source table does not exist, stop and report |
| 112 | + this directly to the user. Do not attempt to guess alternative table |
| 113 | + names unless the user explicitly instructs you to do so. |
| 114 | +4. **No Output Shortcutting or Hallucinated Artifacts**: |
| 115 | + * Present the complete downstream blast radius table directly in your |
| 116 | + final response. Avoid telling the user you have created a separate |
| 117 | + markdown file or artifact containing the details unless you have |
| 118 | + explicitly executed file-writing tools to create it. |
| 119 | + |
| 120 | +## Reference Directory |
| 121 | + |
| 122 | +- [MCP Usage](references/mcp-usage.md): Using the Google Cloud Data Lineage |
| 123 | + remote MCP server and tool preferences. |
| 124 | + |
| 125 | +## External Documentation |
| 126 | + |
| 127 | +- [Google Cloud Dataplex Data Lineage Documentation](https://cloud.google.com/dataplex/docs/data-lineage) |
| 128 | +- [Use the Data Lineage MCP server](https://docs.cloud.google.com/dataplex/docs/use-lineage-mcp) |
| 129 | +- [Dataplex Data Lineage API Reference](https://cloud.google.com/dataplex/docs/reference/data-lineage/rest) |
0 commit comments