Skip to content

曝光

曝光可以定义和描述dbt项目的下游使用,例如在仪表板、应用程序或数据科学管道中。通过定义曝光,您可以: - 运行、测试并列出提供您的公开的资源 - 在自动生成的文档站点中填充与数据消费者相关的上下文的专用页面

发布一个曝光

曝光是在.yml文件中的exposures:键下定义的。

version: 2

exposures:

  - name: weekly_jaffle_metrics
    label: Jaffles by the Week
    type: dashboard
    maturity: high
    url: https://bi.tool/dashboards/1
    description: >
      Did someone say "exponential growth"?

    depends_on:
      - ref('fct_orders')
      - ref('dim_customers')
      - source('gsheets', 'goals')
      - metric('count_orders')

    owner:
      name: Callum McData
      email: data@jaffleshop.com

version: 2

exposures:

  - name: weekly_jaffle_report
    type: dashboard
    maturity: high
    url: https://bi.tool/dashboards/1
    description: >
      Did someone say "exponential growth"?

    depends_on:
      - ref('fct_orders')
      - ref('dim_customers')
      - source('gsheets', 'goals')

    owner:
      name: Claire from Data
      email: data@jaffleshop.com

可用属性

必须项: - name: 唯一名称且按照蛇形命名方式 - type: dashboard, notebook, analysis, ml, application中的一个 (用于在文档站点中组织) - owner: email

期望项: - depends_on: 可引用节点的列表,包括ref, source, 和 metric (虽然有可能,但您不太可能需要exposure来直接依赖source)

期望项: - depends_on: 可引用节点的列表,包括ref and source (虽然有可能,但您不太可能需要exposure来直接依赖source)

可选项: - url: 在生成的文档站点的右上角启用 查看此公开 - maturity: high, medium, low中的一个 - owner: name

一般属性 (可选) - description - tags - meta

我们计划在未来的版本中添加更多子类型和可选属性。

引用曝光

定义曝光后,可以运行引用该曝光的命令:

dbt run -s +exposure:weekly_jaffle_report
dbt test -s +exposure:weekly_jaffle_report

当我们生成文档网站时,您会看到曝光出现:

dbt文档中每个曝光的专用页面

曝光在DAG中显示为橙色节点