Skip to content

数据与执行命令

这一页覆盖数据接入、建模、指标、执行和智能能力,和 hbi-datahbi-data-modelinghbi-pipelinehbi-notebookhbi-data-alerthbi-data-agent 等 skills 最接近。每个命令域都提供最小可用示例与典型输出,让你第一次就能照着跑。

HQL 表达式

本页的 data-model querymetricmeasure 等命令广泛使用 HQL (Hengshi Query Language) 表达式来定义聚合、计算字段和查询条件。HQL 支持聚合函数(SUM、AVG、COUNT 等)、时间函数(YEAR、MONTH、PERIODCOMPARE 等)和条件逻辑。完整的函数列表请参考 HQL 函数参考

connection

用途:管理数据连接、浏览库表、测试连通性。

常见子命令

  • 连接本体:types list show test create delete update
  • 内部授权规则:auth-rules auth-rule-get auth-rule-create auth-rule-update auth-rule-delete
  • 继承控制:auth-inherit-get auth-inherit-update
  • 数据浏览:browse query

最小可用示例

bash
hbi connection list --output json

典型输出

json
[
  {
    "id": 39774,
    "title": "analytics-db",
    "accessCount": 273,
    "options": {
      "type": "postgresql",
      "maxConnNum": 10,
      "metaConfig": {
        "dbMajorVersion": 13,
        "dbMinorVersion": 11,
        "dbProductName": "PostgreSQL"
      }
    },
    "createdAt": "2022-10-27 13:54:24",
    "visible": true
  }
]

下一步常见动作

  • 查看连接详情:hbi connection show 39774 --output json
  • 测试连通性:hbi connection test 39774
  • 浏览库表:hbi connection browse 39774 --output json

dataset

用途:管理数据集、字段、粒度、预览和导入导出。

常见子命令

  • 生命周期:list show update replace delete duplicate import
  • 预览与状态:preview status schedule lineage export
  • 知识增强:knowledge example
  • 创建路径:create create-from-file upload create-custom-sql create-api create-reference
  • 数据加工:create-union create-fusion create-aggregate create-pivot create-unpivot
  • 字段与表达式:fields expression-rewrite column-create column-update column-delete
  • 字段补充:column-values column-geo column-geo-role column-geo-role-reset
  • 粒度:granularity-list granularity-create granularity-update granularity-delete

最小可用示例

bash
hbi dataset list --app 4812 --output json

典型输出

json
[
  {
    "id": 3,
    "title": "销售订单明细",
    "appId": 4812,
    "connectionId": 39774,
    "createdAt": "2025-01-10 09:00:00",
    "updatedAt": "2026-05-20 16:30:00",
    "status": "ready"
  }
]

下一步常见动作

  • 预览数据:hbi dataset preview --app 4812 --dataset 3 --limit 10 --output json
  • 查看字段:hbi dataset fields --app 4812 --dataset 3 --output json
  • 查看数据集状态:hbi dataset status --app 4812 --dataset 3 --output json

data-model

用途:管理数据模型与联表关系。

常见子命令

  • list show preview query
  • lineage tree
  • suggest-joins
  • join-add join-list join-delete

最小可用示例

bash
hbi data-model query --app 4812 --dataset 3 "SUM({amount})" --output json

典型输出

json
{
  "result": [
    {
      "SUM({amount})": 1234567.89
    }
  ],
  "executionTime": 234
}

下一步常见动作

  • 按维度分组:hbi data-model query --app 4812 --dataset 3 "SUM({amount})" --by "group({region})" --output json
  • 查看模型树:hbi data-model tree --app 4812 --dataset 3 --output json
  • 推荐联表:hbi data-model suggest-joins --app 4812 --dataset 3 --output json

metric

用途:管理原子指标。

常见子命令

  • create delete update
  • list show
  • query

最小可用示例

bash
hbi metric list --app 4812 --dataset 3 --output json

典型输出

json
[
  {
    "id": 101,
    "name": "销售总额",
    "expression": "SUM({amount})",
    "datasetId": 3,
    "createdAt": "2025-02-10 10:00:00"
  }
]

下一步常见动作

  • 查看指标详情:hbi metric show --app 4812 --dataset 3 c1 --output json
  • 查询指标数据:hbi metric query --app 4812 --dataset 3 c1 --output json

measure

用途:管理业务指标。

常见子命令

  • create delete update
  • list show
  • query

最小可用示例

bash
hbi measure list --app 4812 --dataset 3 --output json

典型输出

json
[
  {
    "id": 201,
    "name": "月度销售增长率",
    "expression": "PERCENTCHANGE(SUM({amount}), month({date}))",
    "datasetId": 3,
    "createdAt": "2025-03-15 11:00:00"
  }
]

下一步常见动作

  • 查看业务指标详情:hbi measure show --app 4812 --dataset 3 m1 --output json
  • 搜索业务指标:hbi measure query --app 4812 --query "销售" --output json

pipeline

用途:管理数据集成流程和节点。

常见子命令

  • 流程本体:list show create update delete duplicate
  • 运行状态:status errors schedule
  • 节点读写:node edit

最小可用示例

bash
hbi pipeline list --output json

典型输出

json
[
  {
    "id": 450,
    "title": "日报数据汇总",
    "createdAt": "2025-04-01 08:00:00",
    "updatedAt": "2026-05-25 10:00:00",
    "status": "success"
  }
]

下一步常见动作

  • 查看流程详情:hbi pipeline show 450 --output json
  • 查看执行状态:hbi pipeline status 450 --output json
  • 编辑节点:hbi pipeline edit add 450 --help

edit 是最常见的下一层入口,常见子命令包括:

  • add
  • remove
  • connect

notebook

用途:管理 Notebook、段落和执行相关配置。

常见子命令

  • Notebook 本体:list show create update delete
  • 段落:paragraphs add-paragraph update-paragraph execute delete-paragraph
  • 连接:connections add-connection authorize-connection revoke-connection remove-connection
  • 其他:schedule languages

最小可用示例

bash
hbi notebook list --output json

典型输出

json
[
  {
    "id": 350,
    "title": "数据分析笔记",
    "createdAt": "2025-05-10 14:00:00",
    "updatedAt": "2026-06-01 09:30:00"
  }
]

下一步常见动作

  • 查看 Notebook 详情:hbi notebook show 350 --output json
  • 列出段落:hbi notebook paragraphs 350 --output json
  • 执行段落:hbi notebook execute 350 para_123

data-alert

用途:管理数据预警。

常见子命令

  • list show
  • create update delete
  • enable disable
  • validate

最小可用示例

bash
hbi data-alert list 4812 --output json

典型输出

json
[
  {
    "id": 520,
    "title": "日销售额预警",
    "enabled": true,
    "createdAt": "2025-06-01 10:00:00"
  }
]

下一步常见动作

  • 查看预警详情:hbi data-alert show 4812 520 --output json
  • 启用预警:hbi data-alert enable 4812 520
  • 禁用预警:hbi data-alert disable 4812 520 --dry-run

data-agent

用途:管理 Data Agent / ChatBI 后台配置。

常见子命令

  • config
  • prompt
  • vector

最小可用示例

bash
hbi data-agent config get --output json

典型输出

json
{
  "enabled": true,
  "model": "gpt-4",
  "basePrompt": "你是一个数据分析助手",
  "updatedAt": "2026-05-30 16:00:00"
}

下一步常见动作

  • 查看 prompt 列表:hbi data-agent prompt list --output json
  • 查看向量化状态:hbi data-agent vector status --output json

继续下钻建议

场景先进入哪层命令树
数据连接、库表浏览、连通性测试connection
数据集生命周期、预览、字段与粒度dataset
联表关系与模型查询data-model
数据集成流程本体pipeline
节点增删改连线pipeline edit
Notebook、段落与连接notebook
预警定义与启停data-alert
Data Agent 配置、Prompt 与向量状态data-agent

需要具体参数和示例时,再在终端查看对应层级的 --help

衡石分析平台使用手册