Loading...
Loading...
Compare original and translation side by side
undefinedundefined
```bash
```bash
```bash
```bash
---
> **Tip**: Use `-o json` to force structured output for programmatic parsing, or `-o human` for readable tables. The default is `auto` (human in a TTY, JSON when piped).
---
> **提示**:使用`-o json`强制输出结构化内容以便程序化解析,或使用`-o human`输出易读的表格。默认值为`auto`(在终端中输出人类可读格式,管道传输时输出JSON)。orderscatalog.schemamain.salesdatabricks sql warehouses listcatalog.schema.[topic_name]_mv⚠️ STOP — Confirm all answers before proceeding. The metric view will be namedby default.[topic_name]_mv
orderscatalog.schemamain.salesdatabricks sql warehouses listcatalog.schema.[topic_name]_mv⚠️ 停止 — 继续前确认所有答案。Metric View默认命名为。[topic_name]_mv
omni models list --modelkind SHAREDidomni models list --modelkind SHAREDidomni models yaml-get <modelId> --filename <topic_name>.topicbase_viewjoinsfieldsalways_filterai_contextsample_queriesomni models yaml-get <modelId> --filename <topic_name>.topicbase_viewjoinsfieldsalways_filterai_contextsample_queriesomni models yaml-get <modelId> --filename relationshipsomni models yaml-get <modelId> --filename relationshipsbase_viewjoinsomni models yaml-get <modelId> --filename <view_name>.viewIf a view is prefixed with, fetch the file starting withomni_dbt_. Skip any view backed byomni_dbt_— it has no physical table.derived_table.sql
base_viewjoinsomni models yaml-get <modelId> --filename <view_name>.view如果视图前缀为,则获取以omni_dbt_开头的文件。跳过任何由omni_dbt_支持的视图 — 它没有物理表。derived_table.sql
catalog.schema.table| Omni view name | Databricks table |
|---|---|
| |
| |
__joinsjoins:
user_order_facts: {} # skip — derived CTE
ecomm__users: {} # joins to base_view
ecomm__inventory_items: # joins to base_view
ecomm__products: # joins to inventory_itemsprimary_key: true✋ STOP — Confirm the full table list and join hierarchy with the user before continuing.
catalog.schema.table| Omni视图名称 | Databricks表 |
|---|---|
| |
| |
__joinsjoins:
user_order_facts: {} # skip — derived CTE
ecomm__users: {} # joins to base_view
ecomm__inventory_items: # joins to base_view
ecomm__products: # joins to inventory_itemsprimary_key: true✋ 停止 — 继续前与用户确认完整的表列表和关联层级。
| Syntax | Meaning |
|---|---|
(no | Include all fields from all views |
| Include all fields from all views / named view |
| Include all fields with this tag |
| Include this specific field |
| Exclude this field (always wins over wildcard inclusions) |
hidden: true| 语法 | 含义 |
|---|---|
(无 | 包含所有视图中的全部字段 |
| 包含所有视图/指定视图中的全部字段 |
| 包含带有此标签的所有字段 |
| 包含此特定字段 |
| 排除此字段(始终优先于通配符包含) |
hidden: truerelationships.yamlon_sqlon:namejoins:
- name: ecomm__users
source: catalog.ecomm.users
'on': source.user_id = ecomm__users.idjoins:
- name: ecomm__inventory_items
source: catalog.ecomm.inventory_items
'on': source.inventory_item_id = ecomm__inventory_items.id
joins:
- name: ecomm__products
source: catalog.ecomm.products
'on': ecomm__inventory_items.product_id = ecomm__products.id⚠️is a YAML 1.1 reserved word — always single-quote the key ason. Columns from nested (2+ level) joins cannot be used in'on':— flatten them through a denormalized direct join instead.expr
relationships.yamlon_sqlon:namejoins:
- name: ecomm__users
source: catalog.ecomm.users
'on': source.user_id = ecomm__users.idjoins:
- name: ecomm__inventory_items
source: catalog.ecomm.inventory_items
'on': source.inventory_item_id = ecomm__inventory_items.id
joins:
- name: ecomm__products
source: catalog.ecomm.products
'on': ecomm__inventory_items.product_id = ecomm__products.id⚠️是YAML 1.1的保留字 — 始终将键用单引号括起来,即on。嵌套(2级及以上)关联中的列不能用于'on':— 改为通过非规范化直接关联来展平它们。expr
| Omni field type | Databricks translation |
|---|---|
| Standard string/number | |
| Single timestamp dimension |
| One |
| |
| |
| |
| BOOLEAN dimension (not a filter; omit |
| Omni measure type | Databricks translation |
|---|---|
| |
| |
| |
| Derived (refs other measures) | |
| |
${view.column}join_name.columndisplay_namelabelcommentdescriptionsynonymsai_contextcomment✋ STOP — Review all dimensions, measures, and join definitions with the user before generating the final output.
| Omni字段类型 | Databricks转换结果 |
|---|---|
| 标准字符串/数字 | |
| 单个时间戳维度 |
| 每个时间范围对应一个 |
| |
| |
| |
| BOOLEAN维度(不是过滤器;省略 |
| Omni度量类型 | Databricks转换结果 |
|---|---|
| |
| |
| |
| 派生(引用其他度量) | |
度量上的 | |
${view.column}join_name.columndisplay_namelabelcommentdescriptionsynonymsai_contextcomment✋ 停止 — 生成最终输出前,与用户审核所有维度、度量和关联定义。
databricks api post /api/2.0/sql/statements \
--json "{\"warehouse_id\": \"<WAREHOUSE_ID>\", \"statement\": \"SHOW VIEWS IN <catalog>.<schema> LIKE '%_mv'\", \"wait_timeout\": \"30s\", \"catalog\": \"<CATALOG>\", \"schema\": \"<SCHEMA>\"}"CREATE OR REPLACE VIEW ... WITH METRICSALTER VIEW ... AS $$ ... $$databricks api post /api/2.0/sql/statements \
--json "{\"warehouse_id\": \"<WAREHOUSE_ID>\", \"statement\": \"SHOW VIEWS IN <catalog>.<schema> LIKE '%_mv'\", \"wait_timeout\": \"30s\", \"catalog\": \"<CATALOG>\", \"schema\": \"<SCHEMA>\"}"CREATE OR REPLACE VIEW ... WITH METRICSALTER VIEW ... AS $$ ... $$-- CREATE (new view)
CREATE OR REPLACE VIEW catalog.schema.orders_mv
WITH METRICS
LANGUAGE YAML
AS $$
version: 1.1
comment: "..."
source: catalog.ecomm.order_items
joins:
- name: ecomm__users
source: catalog.ecomm.users
'on': source.user_id = ecomm__users.id
dimensions:
- name: id
expr: id
display_name: "Order ID"
- name: status
expr: status
display_name: "Order Status"
measures:
- name: order_count
expr: COUNT(*)
display_name: "Order Count"
- name: total_sale_price
expr: SUM(sale_price)
display_name: "Total Sale Price"
format:
type: currency
currency_code: USD
$$-- ALTER (existing view)
ALTER VIEW catalog.schema.orders_mv AS $$
version: 1.1
...
$$databricks sql executedatabricks api post /api/2.0/sql/statements \
--json "{
\"warehouse_id\": \"<WAREHOUSE_ID>\",
\"statement\": $(cat /tmp/orders_mv.sql | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'),
\"wait_timeout\": \"50s\",
\"catalog\": \"<CATALOG>\",
\"schema\": \"<SCHEMA>\"
}""state": "SUCCEEDED""state": "FAILED"status.error.message✋ STOP — Confirm which group or user should receive access before running the GRANT. This is a permission change visible to others.
databricks api post /api/2.0/sql/statements \
--json "{\"warehouse_id\": \"<WAREHOUSE_ID>\", \"statement\": \"GRANT SELECT ON VIEW catalog.schema.orders_mv TO \`group_name\`\", \"wait_timeout\": \"30s\", \"catalog\": \"<CATALOG>\", \"schema\": \"<SCHEMA>\"}"-- CREATE (new view)
CREATE OR REPLACE VIEW catalog.schema.orders_mv
WITH METRICS
LANGUAGE YAML
AS $$
version: 1.1
comment: "..."
source: catalog.ecomm.order_items
joins:
- name: ecomm__users
source: catalog.ecomm.users
'on': source.user_id = ecomm__users.id
dimensions:
- name: id
expr: id
display_name: "Order ID"
- name: status
expr: status
display_name: "Order Status"
measures:
- name: order_count
expr: COUNT(*)
display_name: "Order Count"
- name: total_sale_price
expr: SUM(sale_price)
display_name: "Total Sale Price"
format:
type: currency
currency_code: USD
$$-- ALTER (existing view)
ALTER VIEW catalog.schema.orders_mv AS $$
version: 1.1
...
$$databricks sql executedatabricks api post /api/2.0/sql/statements \
--json "{
\"warehouse_id\": \"<WAREHOUSE_ID>\",
\"statement\": $(cat /tmp/orders_mv.sql | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'),
\"wait_timeout\": \"50s\",
\"catalog\": \"<CATALOG>\",
\"schema\": \"<SCHEMA>\"
}""state": "SUCCEEDED""state": "FAILED"status.error.message✋ 停止 — 运行GRANT前,确认哪些组或用户应获得访问权限。这是对他人可见的权限变更。
databricks api post /api/2.0/sql/statements \
--json "{\"warehouse_id\": \"<WAREHOUSE_ID>\", \"statement\": \"GRANT SELECT ON VIEW catalog.schema.orders_mv TO \`group_name\`\", \"wait_timeout\": \"30s\", \"catalog\": \"<CATALOG>\", \"schema\": \"<SCHEMA>\"}""state": "FAILED"status.error.message| Error message contains | Likely cause | Fix |
|---|---|---|
| Invalid YAML field or value | Check the field name against the valid keys ( |
| Warehouse is stopped or wrong ID | Start the warehouse in the Databricks UI or verify the ID with |
| The CLI profile lacks privileges | Check the profile's permissions on the catalog/schema with |
| A source or join table doesn't exist in Unity Catalog | Verify each table reference with |
| | Always write |
| Timeout out of range | |
"wait_timeout": "5s""state": "FAILED"status.error.message| 错误消息包含 | 可能原因 | 修复方案 |
|---|---|---|
| YAML字段或值无效 | 检查字段名称是否符合有效键( |
| 仓库已停止或ID错误 | 在Databricks UI中启动仓库,或通过 |
| CLI配置文件缺少权限 | 通过 |
| 源表或关联表在Unity Catalog中不存在 | 通过 |
| | 始终写入 |
| 超时超出范围 | |
"wait_timeout": "5s"[topic_name]_mvCREATE OR REPLACEALTER VIEWversion: 1.1derived_table.sqltype: yesnodata_typeMEASURE()on'on':MAPexpr-view.fieldnumbercurrencydatedate_timepercentagebytetype: datetype: date_timedate_formatcurrency_code: USDiso_code: USDdecimal_placesdatabricks api post /api/2.0/sql/statementswait_timeout5s50s--filename--file-namecomment:description:description[topic_name]_mvCREATE OR REPLACEALTER VIEWversion: 1.1derived_table.sqltype: yesnodata_typeMEASURE()on'on':MAPexpr-view.fieldnumbercurrencydatedate_timepercentagebytetype: datetype: date_timedate_formatcurrency_code: USDiso_code: USDdecimal_placesdatabricks api post /api/2.0/sql/statementswait_timeout5s50s--filename--file-namecomment:description:description