Search code examples
dbt

Referenceing an exposure in dbt


I am new to using exposures. I want show more than 1 step downstream. Is it possible to make an exposure that depends on another exposure? How do you reference it? I tried this but it doesn't work. It says there is no node Step1:

  - name: Step1
    depends_on: 
      - ref('MyTable')

  - name: Step2
    depends_on: 
      - ref('Step1')

Solution

  • This isn't supported today. Exposures are leaf nodes in the directed, acyclic graph.

    However there is a dbt-core GitHub issue today lists what you're asking for as a potential new feature:

    exposures that depend on other exposures:

    one exposure for each Mode query / Looker view, one exposure for the dashboard that depends on those queries / views

    Until then, the best you can do if you have a DAG like: table_A -> exposure1 -> exposure2, then you could restructure it like:

             exposure1
            /
    table_A
            \
             exposure2
    

    IMHO, documenting only exposure1 is sufficient, but sounds like you'd like more.