SuperAPI AI 工具集

cargo-storage

数据与分析

查看项目

更新于 10-15 21:51

技能介绍

用途:管理 Cargo 工作区的数据层,包括模型(如 Companies、Contacts、Deals)、数据集、列、关系、统一化(unification)与记录,并对工作区存储执行 SQL 查询。

主要能力:

  • 资源浏览:storage dataset list / model list / column list / relationship list / record list;model list 无过滤参数,需用 jq 等客户端过滤。
  • 模型操作:model get、get-ddl(查看完整 schema 与 SQL 方言,如 BigQuery 或 Snowflake)、create、update、remove。
  • 列管理:column create / update / remove / reorder;列类型有 string、number、boolean、date、object、array、vector、any;列种类有 custom、computed、metric、lookup。
  • 关系管理:relationship set 会整体替换数据集的全部关系,需先 list 再回传完整数组。unify 模型的关系由同步自动生成,不接受手动设置。
  • 统一化:model update 的 --unification 可配置 integration 或 custom,含 type、uniqueColumns、selectedColumnSlugs、timeColumnSlug、parent、filter;写入配置不会自动重算,需 storage run create 后轮询 storage run list,并用查询核对行数。
  • 记录写入:ingest 模型(extractor 的 mode.kind 为 ingest)通过 Webhook URL 接收记录,该 URL 由 baseUrl、model-uuid 与 token 拼装;autoIngest 为 true 时不应外发 URL。工作流内写入应使用原生 modelUpsert / modelInsert 动作,而非该 webhook。
  • SQL 查询:storage query execute 执行 SQL,表名为 <datasetSlug>.<modelSlug>(如 default.companies);storage query download 导出 CSV(默认)或 Parquet,返回签名 URL。分页用 SQL 的 LIMIT / OFFSET。查询免费。

必要用法:先安装 npm install -g @cargo-ai/cli(无全局安装时命令前加 npx @cargo-ai/cli),再 cargo-ai login --email you@company.com(也支持 --oauth 或 --token <api-token>),并用 cargo-ai whoami 确认工作区。命令输出为 JSON,失败时非零退出并返回 errorMessage;创建 run 或 batch 的操作是异步的,需 --wait-until-finished 或轮询对应的 get。

适用场景:数据模型与 schema 的检查、创建和调整;数据集与关系的配置;统一化规则设置并触发同步;通过 SQL 查询、预览与导出记录。

限制:资料未提供价格、性能或数据量上限等信息。用户须自行妥善保管 API token;细节可参考随附的 references 文档(response-shapes、troubleshooting、examples 各文件)。