Skip to content

Commit

Permalink
chore: Add example dbt exposures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo Lares authored and Jo Lares committed Feb 27, 2024
1 parent a3af509 commit 7d70b2c
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 22 deletions.
12 changes: 6 additions & 6 deletions dbt_profiles.snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
dbt_demo:
outputs:
dev:
account: __SNOWFLAKE_ACCOUNT__
database: __SNOWFLAKE_DATABASE__
password: __SNOWFLAKE_PASSWORD__
role: __SNOWFLAKE_ROLE__
account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}"
database: "{{ env_var('SNOWFLAKE_DATABASE') }}"
password: "{{ env_var('SNOWFLAKE_PASSWORD') }}"
role: "{{ env_var('SNOWFLAKE_ROLE') }}"
schema: PUBLIC
threads: 10
type: snowflake
user: __SNOWFLAKE_USER__
warehouse: __SNOWFLAKE_WAREHOUSE__
user: "{{ env_var('SNOWFLAKE_USER') }}"
warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE') }}"
target: dev
6 changes: 2 additions & 4 deletions docs/git-branching-model.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions models/example/schema.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
---
version: 2

##
## DAG Sources
## See dbt docs: https://docs.getdbt.com/docs/build/sources
##
sources:
- name: jaffle_shop
database: raw
schema: jaffle_shop
tables:
- name: orders
- name: customers

models:
- name: my_first_dbt_model
description: A starter dbt model
Expand All @@ -13,3 +26,33 @@ models:
- name: id
description: The primary key for this table
tests: [unique, not_null]

##
## Exposures define downstream uses of the dbt project,
## See dbt docs: https://docs.getdbt.com/docs/build/exposures
##
exposures:
- name: weekly_jaffle_metrics
label: Weekly Jaffle Metrics
type: dashboard

# Indicates the level of confidence (stability) in the exposure.
# Options:
# - high (i.e. for a well-established dashboard, widely used and trusted within your organizatio)
# - medium
# - low (i.e. for a new or experimental analysis)
maturity: high

url: https://bi.tool/dashboards/1

description: >
Did someone say "exponential growth"?
depends_on:
- ref('my_first_dbt_model')
- source('jaffle_shop', 'orders')
# - metric('count_orders')

owner:
name: Jo Lares
email: jolares@jaffleshop.com
6 changes: 6 additions & 0 deletions package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
packages:
- package: dbt-labs/codegen
version: 0.12.1
- package: dbt-labs/dbt_utils
version: 1.1.1
sha1_hash: acdde602cd2e228b1dac1cf1a7e5f98f12c16b3b
8 changes: 8 additions & 0 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
# See https://hub.getdbt.com/dbt-labs/codegen/latest/
- package: dbt-labs/codegen
version: 0.12.1

# See https://github.com/tnightengale/dbt-meta-testing/tree/0.3.6/
- package: tnightengale/dbt_meta_testing
version: 0.3.6
19 changes: 7 additions & 12 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
##

if [ -z "${DBT_PROJECT_NAME}" ]; then
echo "Environment variable DBT_PROJECT_NAME is not set"
echo "[Error] Environment variable DBT_PROJECT_NAME is not set"
exit 1
fi

if [ -z "${DBT_WAREHOUSE_PROVIDER}" ]; then
echo "Environment variable DBT_WAREHOUSE_PROVIDER is not set"
echo "[Error] Environment vartarget='dev'iable DBT_WAREHOUSE_PROVIDER is not set"
exit 1
fi

Expand Down Expand Up @@ -72,16 +72,11 @@ fi
# Confirm that the dbt installation was successful.
dbt --version

python -m pip install -r requirements.txt

# dbt init $DBT_PROJECT_NAME

##
## Setup dbt connection profile to data warehouse
##
# Install dbt packages specified in package.yml
dbt deps

# TODO
# ...
# Install Python packages
python -m pip install -r requirements.txt

# Verify dbt connection profile to data warehouse
dbt debug
dbt debug

0 comments on commit 7d70b2c

Please sign in to comment.