question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move explore configuration to dbt exposures

See original GitHub issue

The next dbt release introduces meta to dbt exposures: https://github.com/dbt-labs/dbt/releases/tag/v0.20.0rc1 https://github.com/dbt-labs/dbt/pull/3405

What is an exposure?

An exposure doesn’t have much meaning in dbt beyond providing lineage and a link from dbt docs to the “exposure”: https://docs.getdbt.com/docs/building-a-dbt-project/exposures

A notable feature of exposures, is that they can reference multiple tables, providing the lineage into that exposure node.

image

Why move to exposures?

Currently we add sql join logic on to a single model, which is messy because it specifies joins to other tables that might not necessarily exist. dbt exposures makes explicit the tables necessary for that exposure to be valid. So I think it makes much more sense to define the joins here.

We have an outstanding issue #121 to figure out lineage of joins, we’d get that for free with exposures.

We have another issue #170 to hide certain models in the UI, exposures would also be helpful here

It also teases out the distinct entities: an explore is made of one or more models. At the moment it’s a bit confusing that a model is an explore but also might join to another model in another explore.

What if I want my users dbt model as the base for two different explores?! That’s totally reasonable and impossible today.

The future

Finally there is a lot of future configuration that really doesn’t live at the model level. See the options for a looker explore: https://docs.looker.com/reference/explore-reference

e.g.

  • access - who can see this explore
  • renaming - base tables might be renamed to something more sensible depending on the context of the explore
  • default filters - restricting the entire explore to the last 6 months of data for example: https://docs.looker.com/reference/explore-params/sql_always_where
  • anything related to join logic - hiding metrics that don’t make sense, handling symmetric aggregates, etc.

Example

exposures:
  
  - name: jaffle_metrics # becomes name of explore (doesn't have to be the base model name)
    type: dashboard  # dbt specific - dashboard|notebook|analysis|ml|application
    url: https://bi.tool/dashboards/1 # this is optional, ideally we need to pass this information back :(
    description: >
      Did someone say "exponential growth"?   # becomes the description of the explore
    owner: oliver@hello.com   # This is required, not that useful to us (unless we map it to a user in lightdash in future ❤️ )
    
    depends_on:                  # These tables are available as joins
      - ref('fct_orders')
      - ref('dim_customers')
      - source('gsheets', 'goals')    # unsure if we should support sources
      
    meta:
      base: ref('fct_orders')
      joins:
        - model: ref('dim_customers')
           sql_on: ${fct_orders}.customer_id = ${dim_customers}.id

(mixing dbt references and lightdash references looks very messy here, need to think about that)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TuringLovesDeathMetalcommented, Jul 7, 2021

ohhhhhhhh I see what you’re saying. So basically, every model is a “model” in Lightdash, but then you have “Explores” which are built from model(s) but can be multiple models joined together or a subset of data from a model (e.g. with a filter).

This actually makes a lot of sense! I really like it!

0reactions
stale[bot]commented, May 21, 2022

Is this issue still relevant? There have been no updates for 60 days, please close the issue or keep the conversation going!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exposures - dbt Developer Hub
Exposures make it possible to define and describe a downstream use of your dbt project, such as in a dashboard, application, or data...
Read more >
Introducing dbt Exposures for Hightouch
Setting up dbt Exposures in Hightouch. To activate dbt Exposures in Hightouch, head to the Extensions tab and select the dbt-compatible source ...
Read more >
New node type: reports · Issue #2730 · dbt-labs/dbt-core · GitHub
We want to be able to push information about data quality and lineage from dbt into external tools. Exposures should be the Core...
Read more >
Defining Exposures in dbt | by Alex Ostojic
Exposures are a powerful feature in dbt that allows you to represent downstream dependencies of your dbt project, within dbt itself. This enriches...
Read more >
Exposures in DBT - Stack Overflow
dbt would automatically handle the downstream references. It's important to make sure that all your models and sources are properly configured ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found