2023年3月14日 07:27

通过暴露,可以定义和描述将要在dbt项目下游使用的资源,例如在仪表板、应用程序或数据科学管道中。通过定义暴露,您可以:

  • 运行、测试并列出为您的曝光提供的资源
  • 使用与数据使用者相关的上下文填充自动生成的文档站点中的专用页面

声明暴露

在模型配置文件种声明
models/<filename>.yml
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

引用暴露

定义曝光后,可以运行引用它的命令:
dbt run -s +exposure:weekly_jaffle_report
dbt test -s +exposure:weekly_jaffle_report
当我们生成文档站点时,您将看到以下信息:
替代文字
替代文字
暴露的模型在DAG种显示为橙色。