Community编程与开发github.com

googlebigquery-automation

通过 Rube MCP(Composio)自动执行 Google BigQuery 任务:运行 SQL 查询、探索数据集和元数据,并通过 Metabase 集成执行 MBQL 查询。始终先搜索工具以获取当前架构。

googlebigquery-automation 是什么?

该技能通过 Rube MCP(Composio)集成,自动化 Google BigQuery 任务。它允许 AI 代理运行原生 SQL 查询、执行结构化 Metabase 查询语言 (MBQL) 查询、检索数据库和表元数据,并列出可用的数据库。该技能主要依赖 Metabase 作为 BigQuery 数据源的前端,通过 Metabase 的 API 执行所有操作。用户必须首先通过 RUBE_SEARCH_TOOLS 确认 Rube MCP 连接,然后通过 RUBE_MANAGE_CONNECTIONS 建立 Metabase 工具包连接。该技能适用于支持 MCP 协议的 AI 客户端,例如 Claude Code、Cursor 和 Codex。主要工作流程包括:发现数据库 ID、探索表结构、参数化 SQL 查询以及将 MBQL 转换为原生 SQL。常用模式是“先发现再查询”——先列出数据库,然后获取详细元数据,最后执行查询。注意,Metabase 使用内部整数 ID 引用数据库和表,这些 ID 与 BigQuery 的项目名或数据集名不同,必须通过元数据工具发现。该技能还指出了常见陷阱,例如嵌套响应结构和字段 ID 的类型要求。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComposioHQ/awesome-claude-skills/tree/master/composio-skills/googlebigquery-automation

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

通过 Rube MCP 实现 Google BigQuery 自动化

通过 Rube MCP(Composio)集成中的 Metabase 运行 SQL 查询、探索数据库架构和分析数据集。

工具包文档:composio.dev/toolkits/googlebigquery

先决条件

  • Rube MCP 必须已连接(RUBE_SEARCH_TOOLS 可用)
  • 通过RUBE_MANAGE_CONNECTIONS 与工具包 metabase 建立活动连接
  • 一个连接到 BigQuery 数据源的 Metabase 实例
  • 始终先调用 RUBE_SEARCH_TOOLS 以获取当前工具架构

设置

获取 Rube MCP:在客户端配置中添加 https://rube.app/mcp 作为 MCP 服务器。无需 API 密钥——只需添加端点即可使用。

  1. 通过确认 RUBE_SEARCH_TOOLS 有响应来验证 Rube MCP 是否可用
  2. 使用工具包 metabase 调用 RUBE_MANAGE_CONNECTIONS
  3. 如果连接状态不是 ACTIVE,请按照返回的身份验证链接完成设置
  4. 在运行任何工作流之前,确认连接状态显示为 ACTIVE

注意:BigQuery 数据通过 Metabase 访问,Metabase 是一种商业智能工具,它将 BigQuery 作为数据源进行连接。以下工具通过 Metabase 的 API 执行查询和检索元数据。

核心工作流

1. 运行原生 SQL 查询

使用 METABASE_POST_API_DATASET 并指定类型为 native 来针对您的 BigQuery 数据库执行原始 SQL 查询。

Tool: METABASE_POST_API_DATASET
Parameters:
  - database (required): Metabase 数据库 ID(整数)
  - type (required): 对于 SQL 查询,使用 "native"
  - native (required): 包含 "query" 字符串的对象
    - query: 原始 SQL 字符串(例如 "SELECT * FROM users LIMIT 10")
    - template_tags: 参数化查询变量(可选)
  - constraints: { "max-results": 1000 }(可选)

2. 运行结构化 MBQL 查询

使用 METABASE_POST_API_DATASET 并指定类型为 query 来执行 Metabase Query Language 查询,该查询具有内置的聚合和过滤功能。

Tool: METABASE_POST_API_DATASET
Parameters:
  - database (required): Metabase 数据库 ID
  - type (required): 对于 MBQL,使用 "query"
  - query (required): 包含以下内容的对象:
    - source-table: 表 ID(整数)
    - aggregation: 例如 [["count"]] 或 [["sum", ["field", 5, null]]]
    - breakout: 分组字段
    - filter: 过滤条件
    - limit: 最大行数
    - order-by: 排序字段

3. 获取查询元数据

使用 METABASE_POST_API_DATASET_QUERY_METADATA 检索可用于查询的数据库、表和字段的元数据。

Tool: METABASE_POST_API_DATASET_QUERY_METADATA
Parameters:
  - database (required): Metabase 数据库 ID
  - type (required): "query" 或 "native"
  - query (required): 查询对象(例如 {"source-table": 1})

4. 将查询转换为原生 SQL

使用 METABASE_POST_API_DATASET_NATIVE 将 MBQL 查询转换为其原生 SQL 表示形式。

Tool: METABASE_POST_API_DATASET_NATIVE
Parameters:
  - database (required): Metabase 数据库 ID
  - type (required): "native"
  - native (required): 包含 "query" 和可选的 "template_tags" 的对象
  - parameters: 查询参数值(可选)

5. 列出可用数据库

使用 METABASE_GET_API_DATABASE 发现 Metabase 中配置的所有数据库连接。

Tool: METABASE_GET_API_DATABASE
Description: 检索 Metabase 中配置的所有 Database 实例列表。
Note: 调用 RUBE_SEARCH_TOOLS 以获取此工具的完整架构。

6. 获取数据库架构元数据

使用 METABASE_GET_API_DATABASE_ID_METADATA 检索特定数据库的完整表和字段信息。

Tool: METABASE_GET_API_DATABASE_ID_METADATA
Description: 检索特定数据库的完整元数据,包括所有表和字段。
Note: 调用 RUBE_SEARCH_TOOLS 以获取此工具的完整架构。

常见模式

  • 先发现后查询:使用 METABASE_GET_API_DATABASE 查找数据库 ID,然后使用 METABASE_GET_API_DATABASE_ID_METADATA 探索表和字段,最后使用 METABASE_POST_API_DATASET 运行查询。
  • 优先使用 SQL:使用 METABASE_POST_API_DATASET 并指定 type: "native",编写标准 SQL 查询以获得最大灵活性。
  • 参数化查询:在原生查询中使用 template_tags 以实现安全参数化(例如 SELECT * FROM users WHERE id = {{user_id}})。
  • 架构探索:在构建复杂查询之前,使用 METABASE_POST_API_DATASET_QUERY_METADATA 了解表结构。
  • 获取参数值:使用 METABASE_POST_API_DATASET_PARAMETER_VALUES 检索过滤器下拉菜单的可能值。

已知陷阱

  • database 参数是 Metabase 内部的整数 ID,而不是 BigQuery 项目或数据集名称。请首先使用 METABASE_GET_API_DATABASE 查找有效的数据库 ID。
  • MBQL 查询中的 source-table 也是 Metabase 内部的整数,而不是 BigQuery 表名。请通过元数据工具发现表 ID。
  • 原生 SQL 查询使用 BigQuery SQL 方言(标准 SQL)。确保您的语法与 BigQuery 兼容。
  • constraints 中的 max-results 默认值可能会限制返回的行数。对于大型结果集,请显式设置。
  • 来自 METABASE_POST_API_DATASET 的响应包含嵌套在 data 下的结果——请仔细解析,因为结构可能深度嵌套。
  • MBQL 的 aggregation、breakout 和 filter 数组中使用的 Metabase 字段 ID 必须是整数,这些整数从元数据响应中获取。

快速参考

动作工具关键参数
运行 SQL 查询METABASE_POST_API_DATASETdatabase,type: "native",native.query
运行 MBQL 查询METABASE_POST_API_DATASETdatabase,type: "query",query
获取查询元数据METABASE_POST_API_DATASET_QUERY_METADATAdatabase,type,query
转换为 SQLMETABASE_POST_API_DATASET_NATIVEdatabase,type,native
获取参数值METABASE_POST_API_DATASET_PARAMETER_VALUESparameter,field_ids
列出数据库METABASE_GET_API_DATABASE(通过 RUBE_SEARCH_TOOLS 查看完整架构)
获取数据库元数据METABASE_GET_API_DATABASE_ID_METADATA(通过 RUBE_SEARCH_TOOLS 查看完整架构)

由 Composio 提供支持

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ably-automation

Automate Ably tasks via Rube MCP (Composio). Always search tools first for current schemas.

abstract-automation

Automate Abstract tasks via Rube MCP (Composio). Always search tools first for current schemas.

abuselpdb-automation

Automate Abuselpdb tasks via Rube MCP (Composio). Always search tools first for current schemas.

abyssale-automation

Automate Abyssale tasks via Rube MCP (Composio). Always search tools first for current schemas.

accelo-automation

Automate Accelo tasks via Rube MCP (Composio). Always search tools first for current schemas.

accredible-certificates-automation

Automate Accredible Certificates tasks via Rube MCP (Composio). Always search tools first for current schemas.

acculynx-automation

Automate Acculynx tasks via Rube MCP (Composio). Always search tools first for current schemas.

active-campaign-automation

Automate ActiveCampaign tasks via Rube MCP (Composio). Always search tools first for current schemas.

addresszen-automation

Automate Addresszen tasks via Rube MCP (Composio). Always search tools first for current schemas.

adobe-automation

Automate Adobe tasks via Rube MCP (Composio). Always search tools first for current schemas.

adrapid-automation

Automate Adrapid tasks via Rube MCP (Composio). Always search tools first for current schemas.

adyntel-automation

Automate Adyntel tasks via Rube MCP (Composio). Always search tools first for current schemas.

aeroleads-automation

Automate Aeroleads tasks via Rube MCP (Composio). Always search tools first for current schemas.

aero-workflow-automation

Automate Aero Workflow tasks via Rube MCP (Composio). Always search tools first for current schemas.

affinda-automation

Automate Affinda tasks via Rube MCP (Composio). Always search tools first for current schemas.

affinity-automation

Automate Affinity tasks via Rube MCP (Composio). Always search tools first for current schemas.

agencyzoom-automation

Automate Agencyzoom tasks via Rube MCP (Composio). Always search tools first for current schemas.

agent-mail-automation

Automate Agent Mail tasks via Rube MCP (Composio). Always search tools first for current schemas.

agentql-automation

Automate Agentql tasks via Rube MCP (Composio). Always search tools first for current schemas.

agenty-automation

Automate Agenty tasks via Rube MCP (Composio). Always search tools first for current schemas.

相关技能