<@U088WCP3B4P> We have begun writing DBT exposures...
# ask-elementary-ai
m
@kapa.ai We have begun writing DBT exposures to allow us to track data lineage downstream of dbt. We already have Elementary OSS configured, however when I attempted to add exposure testing to the DBT project, I ran into a compilation error. I have two models, I'll refer to them here as model_a and model_b, that are completely independent of each other except for a shared exposure. In both model_a and model_b, I have added the following:
Copy code
data_tests:
  - elementary.exposure_schema_validity:
      config:
        tags: ["elementary"]
And when I run with dbt, I get the following:
Copy code
Compilation Error in test elementary_exposure_schema_validity_<model_a>_ (<path/to/model_a>.yml)
  dbt was unable to infer all dependencies for the model "elementary_exposure_schema_validity_<model_a>_".
  This typically happens when ref() is placed within a conditional block.
  
  To fix this, add the following hint to the top of the model "elementary_exposure_schema_validity_<model_a>_":
  
  -- depends_on: {{ ref('<model_b>') }}
  
  > in macro get_rendered_ref (macros/utils/graph/get_rendered_ref.sql)
  > called by macro test_exposure_schema_validity (macros/edr/tests/test_exposure_schema_validity.sql)
  > called by test elementary_exposure_schema_validity_<model_a>_ (<path/to/model_a>.yml)
I have not changed either model in any way other than adding this data test. The exposures look something like this:
Copy code
exposures:
  - name: exposure1
    type: application
    maturity: high
    owner:
      name: <>
      email: <>
    depends_on:
      - ref('model_a')
    description: <>
    meta:
      repository_url: "<git repo>"
      contact_slack: "<slack_channel>"
      criticality: "medium"
      source_tables:
        - "<source_a>"
      referenced_columns:
        - column_name: "model_a_col1"
          description: "Column 1 description"
          node: ref('model_a')
  - name: exposure2
    type: application
    maturity: low
    owner:
      name: <>
      email: <>
    depends_on:
      - ref('model_a')
      - ref('model_b')
    description: <>
    meta:
      repository_url: "<git repo>"
      contact_slack: "<slack_channel>"
      criticality: "medium"
      source_tables:
        - "<source_a>"
        - "<source_b>"
      referenced_columns:
        - column_name: "model_a_col1"
          description: "Column 1 description"
          node: ref('model_a')
        - column_name: "model_b_col2"
          description: "Column 2 description"
          node: ref('model_b')
Do you have any information on the cause of this issue, and how I might be able to resolve it?
k
A message from kapa.ai
New message text here