MCP Tools Reference: dataform.googleapis.com

工具:query_compilation_actions

针对给定的 Dataform 编译结果返回编译结果操作。

name 参数值必须采用 projects/{project_id}/locations/{location}/repositories/{repository}/compilationResults/{compilation_result} 格式。

以下示例演示了如何使用 curl 调用 query_compilation_actions MCP 工具。

Curl 请求
                  
curl --location 'https://dataform.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "query_compilation_actions",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

输入架构

QueryCompilationResultActions 请求消息。

QueryCompilationResultActionsRequest

JSON 表示法
{
  "name": string,
  "pageSize": integer,
  "pageToken": string,
  "filter": string
}
字段
name

string

必需。编译结果的名称。

pageSize

integer

可选。要返回的编译结果数量上限。服务器返回的项目数量可能少于请求的数量。如果未指定,服务器将选择合适的默认值。

pageToken

string

可选。从之前的 QueryCompilationResultActions 调用接收的页面令牌。利用其进行后续页面检索。

进行分页时,提供给 QueryCompilationResultActions 的所有其他参数(page_size 除外)必须与提供页面令牌的调用匹配。

filter

string

可选。返回列表的可选过滤条件。目前仅支持对 file_path 字段进行过滤。

输出架构

QueryCompilationResultActions 响应消息。

QueryCompilationResultActionsResponse

JSON 表示法
{
  "compilationResultActions": [
    {
      object (CompilationResultAction)
    }
  ],
  "nextPageToken": string
}
字段
compilationResultActions[]

object (CompilationResultAction)

编译结果操作的列表。

nextPageToken

string

可作为 page_token 发送并用于检索下一页的令牌。如果省略此字段,则不存在后续页面。

CompilationResultAction

JSON 表示法
{
  "target": {
    object (Target)
  },
  "canonicalTarget": {
    object (Target)
  },
  "filePath": string,

  // Union field compiled_object can be only one of the following:
  "relation": {
    object (Relation)
  },
  "operations": {
    object (Operations)
  },
  "assertion": {
    object (Assertion)
  },
  "declaration": {
    object (Declaration)
  },
  "notebook": {
    object (Notebook)
  },
  "dataPreparation": {
    object (DataPreparation)
  }
  // End of list of possible types for union field compiled_object.

  // Union field _internal_metadata can be only one of the following:
  "internalMetadata": string
  // End of list of possible types for union field _internal_metadata.
}
字段
target

object (Target)

相应操作的标识符。在编译结果中是唯一的。

canonicalTarget

object (Target)

如果项目在未配置任何替换项的情况下进行了编译,则为相应操作的标识符。在编译结果中是唯一的。

filePath

string

相对于工作区根目录的完整路径(包括文件名),其中包含相应操作。

联合字段 compiled_object。已编译的对象。compiled_object 只能是下列其中一项:
relation

object (Relation)

相应操作创建/更新的数据库关系。

operations

object (Operations)

相应操作执行的数据库操作。

assertion

object (Assertion)

相应操作执行的断言。

declaration

object (Declaration)

相应操作声明的声明。

notebook

object (Notebook)

相应操作执行的笔记本。

dataPreparation

object (DataPreparation)

相应操作执行的数据准备。

联合字段 _internal_metadata

_internal_metadata 只能是下列其中一项:

internalMetadata

string

仅限输出。用于在内部提供资源的所有元数据信息。例如:时间戳、标志、状态字段等。此字段的格式为 JSON 字符串。

关系

JSON 表示法
{
  "dependencyTargets": [
    {
      object (Target)
    }
  ],
  "disabled": boolean,
  "tags": [
    string
  ],
  "relationDescriptor": {
    object (RelationDescriptor)
  },
  "relationType": enum (RelationType),
  "selectQuery": string,
  "preOperations": [
    string
  ],
  "postOperations": [
    string
  ],
  "incrementalTableConfig": {
    object (IncrementalTableConfig)
  },
  "partitionExpression": string,
  "clusterExpressions": [
    string
  ],
  "partitionExpirationDays": integer,
  "requirePartitionFilter": boolean,
  "additionalOptions": {
    string: string,
    ...
  },
  "connection": string,
  "tableFormat": enum (TableFormat),
  "fileFormat": enum (FileFormat),
  "storageUri": string
}
字段
dependencyTargets[]

object (Target)

此操作所依赖的操作的列表。

disabled

boolean

相应操作是否已停用(即不应运行)。

tags[]

string

此操作的用户定义任意标记。

relationDescriptor

object (RelationDescriptor)

关系及其列的描述符。

relationType

enum (RelationType)

相应关系的类型。

selectQuery

string

返回此关系应包含的行的 SELECT 查询。

preOperations[]

string

在创建关系之前要执行的 SQL 语句。

postOperations[]

string

创建关系后要执行的 SQL 语句。

incrementalTableConfig

object (IncrementalTableConfig)

为此关系配置 INCREMENTAL_TABLE 设置。仅当 relation_typeINCREMENTAL_TABLE 时才设置。

partitionExpression

string

用于对关系进行分区的 SQL 表达式。

clusterExpressions[]

string

用于对表进行聚簇的列或 SQL 表达式的列表。

partitionExpirationDays

integer

设置分区过期时间(以天为单位)。

requirePartitionFilter

boolean

指定此表的查询是否必须包含对分区列进行过滤的谓词过滤条件。

additionalOptions

map (key: string, value: string)

将作为键值对提供给 CREATE TABLE/VIEW 语句的 OPTIONS 子句的其他选项。如需详细了解支持哪些选项,请参阅 https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language

包含一系列 "key": value 对的对象。示例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }

connection

string

可选。用于指定凭证的连接,这些凭证将用于读取和写入外部存储空间(例如 Cloud Storage)。连接可以采用 {project}.{location}.{connection_id}projects/{project}/locations/{location}/connections/{connection_id} 形式,也可以设置为 DEFAULT。

tableFormat

enum (TableFormat)

可选。BigQuery 表的表格格式。

fileFormat

enum (FileFormat)

可选。BigQuery 表的文件格式。

storageUri

string

可选。存储表数据的外部文件夹的完全限定位置前缀。URI 应采用 gs://bucket/path_to_table/ 格式。

目标

JSON 表示法
{
  "database": string,
  "schema": string,
  "name": string
}
字段
database

string

可选。操作的数据库(Google Cloud 项目 ID)。

schema

string

可选。database 内操作的架构(BigQuery 数据集 ID)。

name

string

可选。操作的名称,位于 databaseschema 内。

RelationDescriptor

JSON 表示法
{
  "description": string,
  "columns": [
    {
      object (ColumnDescriptor)
    }
  ],
  "bigqueryLabels": {
    string: string,
    ...
  }
}
字段
description

string

关系的文字说明。

columns[]

object (ColumnDescriptor)

关系中各列的说明列表。

bigqueryLabels

map (key: string, value: string)

应应用于关系的 BigQuery 标签集。

包含一系列 "key": value 对的对象。示例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }

ColumnDescriptor

JSON 表示法
{
  "path": [
    string
  ],
  "description": string,
  "bigqueryPolicyTags": [
    string
  ]
}
字段
path[]

string

列的标识符。path 中的每个条目都表示一个嵌套级别。

description

string

列的文本说明。

bigqueryPolicyTags[]

string

将应用于相应列的 BigQuery 政策标记的列表。

BigqueryLabelsEntry

JSON 表示法
{
  "key": string,
  "value": string
}
字段
key

string

value

string

IncrementalTableConfig

JSON 表示法
{
  "incrementalSelectQuery": string,
  "refreshDisabled": boolean,
  "uniqueKeyParts": [
    string
  ],
  "updatePartitionFilter": string,
  "incrementalPreOperations": [
    string
  ],
  "incrementalPostOperations": [
    string
  ]
}
字段
incrementalSelectQuery

string

SELECT 查询,用于返回应插入到关系中的行(如果关系已存在且未刷新)。

refreshDisabled

boolean

相应表格是否应受到保护,以免被刷新。

uniqueKeyParts[]

string

用于定义行唯一性的一组列或 SQL 表达式。如果发现任何重复项(如 unique_key_parts 所定义),则关系中只会包含新选择的行(如 incremental_select_query 所定义)。

updatePartitionFilter

string

一种 SQL 表达式条件,用于限制在合并操作中考虑的现有行集(如需了解详情,请参阅 unique_key_parts)。

incrementalPreOperations[]

string

要在将新行插入关系之前执行的 SQL 语句。

incrementalPostOperations[]

string

在将新行插入关系后要执行的 SQL 语句。

AdditionalOptionsEntry

JSON 表示法
{
  "key": string,
  "value": string
}
字段
key

string

value

string

操作

JSON 表示法
{
  "dependencyTargets": [
    {
      object (Target)
    }
  ],
  "disabled": boolean,
  "tags": [
    string
  ],
  "relationDescriptor": {
    object (RelationDescriptor)
  },
  "queries": [
    string
  ],
  "hasOutput": boolean
}
字段
dependencyTargets[]

object (Target)

此操作所依赖的操作的列表。

disabled

boolean

相应操作是否已停用(即不应运行)。

tags[]

string

此操作的用户定义任意标记。

relationDescriptor

object (RelationDescriptor)

任何输出关系及其列的描述符。仅当 has_output 为 true 时才设置。

queries[]

string

将按原样执行的任意 SQL 语句的列表。

hasOutput

boolean

这些操作是否会生成输出关系。

断言

JSON 表示法
{
  "dependencyTargets": [
    {
      object (Target)
    }
  ],
  "parentAction": {
    object (Target)
  },
  "disabled": boolean,
  "tags": [
    string
  ],
  "selectQuery": string,
  "relationDescriptor": {
    object (RelationDescriptor)
  }
}
字段
dependencyTargets[]

object (Target)

相应操作所依赖的操作的列表。

parentAction

object (Target)

相应断言的父操作。仅当此断言是自动生成时才设置。

disabled

boolean

相应操作是否已停用(即不应运行)。

tags[]

string

此操作的用户定义任意标记。

selectQuery

string

必须返回零行的 SELECT 查询,才能使此断言成功。

relationDescriptor

object (RelationDescriptor)

断言的自动生成的视图及其列的描述符。

声明

JSON 表示法
{
  "relationDescriptor": {
    object (RelationDescriptor)
  }
}
字段
relationDescriptor

object (RelationDescriptor)

关系及其列的描述符。仅用作文档,即此处的值不会导致关系元数据发生任何变化。

笔记本

JSON 表示法
{
  "dependencyTargets": [
    {
      object (Target)
    }
  ],
  "disabled": boolean,
  "contents": string,
  "tags": [
    string
  ]
}
字段
dependencyTargets[]

object (Target)

此操作所依赖的操作的列表。

disabled

boolean

相应操作是否已停用(即不应运行)。

contents

string

笔记本的内容。

tags[]

string

此操作的用户定义任意标记。

DataPreparation

JSON 表示法
{
  "dependencyTargets": [
    {
      object (Target)
    }
  ],
  "disabled": boolean,
  "tags": [
    string
  ],

  // Union field definition can be only one of the following:
  "contentsYaml": string,
  "contentsSql": {
    object (SqlDefinition)
  }
  // End of list of possible types for union field definition.
}
字段
dependencyTargets[]

object (Target)

此操作所依赖的操作的列表。

disabled

boolean

相应操作是否已停用(即不应运行)。

tags[]

string

此操作的用户定义任意标记。

联合字段 definition。数据准备的定义。definition 只能是下列其中一项:
contentsYaml

string

以 YAML 字符串形式存储的数据准备定义。

contentsSql

object (SqlDefinition)

数据准备的 SQL 定义。包含 SQL 查询和额外的上下文信息。

SqlDefinition

JSON 表示法
{
  "query": string,
  "errorTable": {
    object (ErrorTable)
  },
  "load": {
    object (LoadConfig)
  }
}
字段
query

string

表示数据准备步骤的 SQL 查询。格式为 Pipe SQL 查询语句。

errorTable

object (ErrorTable)

错误表配置,

load

object (LoadConfig)

加载配置。

ErrorTable

JSON 表示法
{
  "target": {
    object (Target)
  },
  "retentionDays": integer
}
字段
target

object (Target)

错误表目标。

retentionDays

integer

错误表分区过期时间(以天为单位)。仅允许使用正值。

LoadConfig

JSON 表示法
{

  // Union field mode can be only one of the following:
  "replace": {
    object (SimpleLoadMode)
  },
  "append": {
    object (SimpleLoadMode)
  },
  "maximum": {
    object (IncrementalLoadMode)
  },
  "unique": {
    object (IncrementalLoadMode)
  }
  // End of list of possible types for union field mode.
}
字段
联合字段 mode。加载模式 mode 只能是下列其中一项:
replace

object (SimpleLoadMode)

替换目标表

append

object (SimpleLoadMode)

附加到目标表

maximum

object (IncrementalLoadMode)

插入值超过目标表中相应列之前最大值的记录

unique

object (IncrementalLoadMode)

插入目标表中尚不存在某列值的记录

IncrementalLoadMode

JSON 表示法
{
  "column": string
}
字段
column

string

增量加载模式的列名称

RelationType

指示相应关系的类型。

枚举
RELATION_TYPE_UNSPECIFIED 默认值。此值未使用。
TABLE 关系是一个表。
VIEW 关系是视图。
INCREMENTAL_TABLE 关系是增量表。
MATERIALIZED_VIEW 关系是具体化视图。

TableFormat

BigQuery 表支持的表格式。

枚举
TABLE_FORMAT_UNSPECIFIED 默认值。
ICEBERG Apache Iceberg 格式。

FileFormat

BigQuery 表支持的文件格式。

枚举
FILE_FORMAT_UNSPECIFIED 默认值。
PARQUET Apache Parquet 格式。

工具注释

破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌