Spaces:
Sleeping
Sleeping
Jon Solow
commited on
Commit
·
7e0ad06
1
Parent(s):
732d631
Add dbt_yfdash project
Browse files- src/dbt_yfdash/.gitignore +4 -0
- src/dbt_yfdash/README.md +15 -0
- src/dbt_yfdash/analyses/.gitkeep +0 -0
- src/dbt_yfdash/dbt_project.yml +36 -0
- src/dbt_yfdash/macros/.gitkeep +0 -0
- src/dbt_yfdash/models/example/my_first_dbt_model.sql +27 -0
- src/dbt_yfdash/models/example/my_second_dbt_model.sql +6 -0
- src/dbt_yfdash/models/example/schema.yml +21 -0
- src/dbt_yfdash/seeds/.gitkeep +0 -0
- src/dbt_yfdash/snapshots/.gitkeep +0 -0
- src/dbt_yfdash/tests/.gitkeep +0 -0
- src/profile.yml +5 -0
src/dbt_yfdash/.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
target/
|
3 |
+
dbt_packages/
|
4 |
+
logs/
|
src/dbt_yfdash/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Welcome to your new dbt project!
|
2 |
+
|
3 |
+
### Using the starter project
|
4 |
+
|
5 |
+
Try running the following commands:
|
6 |
+
- dbt run
|
7 |
+
- dbt test
|
8 |
+
|
9 |
+
|
10 |
+
### Resources:
|
11 |
+
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
|
12 |
+
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
|
13 |
+
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
|
14 |
+
- Find [dbt events](https://events.getdbt.com) near you
|
15 |
+
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices
|
src/dbt_yfdash/analyses/.gitkeep
ADDED
File without changes
|
src/dbt_yfdash/dbt_project.yml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Name your project! Project names should contain only lowercase characters
|
3 |
+
# and underscores. A good package name should reflect your organization's
|
4 |
+
# name or the intended use of these models
|
5 |
+
name: 'dbt_yfdash'
|
6 |
+
version: '1.0.0'
|
7 |
+
|
8 |
+
# This setting configures which "profile" dbt uses for this project.
|
9 |
+
profile: 'dbt_yfdash'
|
10 |
+
|
11 |
+
# These configurations specify where dbt should look for different types of files.
|
12 |
+
# The `model-paths` config, for example, states that models in this project can be
|
13 |
+
# found in the "models/" directory. You probably won't need to change these!
|
14 |
+
model-paths: ["models"]
|
15 |
+
analysis-paths: ["analyses"]
|
16 |
+
test-paths: ["tests"]
|
17 |
+
seed-paths: ["seeds"]
|
18 |
+
macro-paths: ["macros"]
|
19 |
+
snapshot-paths: ["snapshots"]
|
20 |
+
|
21 |
+
clean-targets: # directories to be removed by `dbt clean`
|
22 |
+
- "target"
|
23 |
+
- "dbt_packages"
|
24 |
+
|
25 |
+
|
26 |
+
# Configuring models
|
27 |
+
# Full documentation: https://docs.getdbt.com/docs/configuring-models
|
28 |
+
|
29 |
+
# In this example config, we tell dbt to build all models in the example/
|
30 |
+
# directory as views. These settings can be overridden in the individual model
|
31 |
+
# files using the `{{ config(...) }}` macro.
|
32 |
+
models:
|
33 |
+
dbt_yfdash:
|
34 |
+
# Config indicated by + and applies to all files under models/example/
|
35 |
+
example:
|
36 |
+
+materialized: view
|
src/dbt_yfdash/macros/.gitkeep
ADDED
File without changes
|
src/dbt_yfdash/models/example/my_first_dbt_model.sql
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/*
|
3 |
+
Welcome to your first dbt model!
|
4 |
+
Did you know that you can also configure models directly within SQL files?
|
5 |
+
This will override configurations stated in dbt_project.yml
|
6 |
+
|
7 |
+
Try changing "table" to "view" below
|
8 |
+
*/
|
9 |
+
|
10 |
+
{{ config(materialized='table') }}
|
11 |
+
|
12 |
+
with source_data as (
|
13 |
+
|
14 |
+
select 1 as id
|
15 |
+
union all
|
16 |
+
select null as id
|
17 |
+
|
18 |
+
)
|
19 |
+
|
20 |
+
select *
|
21 |
+
from source_data
|
22 |
+
|
23 |
+
/*
|
24 |
+
Uncomment the line below to remove records with null `id` values
|
25 |
+
*/
|
26 |
+
|
27 |
+
-- where id is not null
|
src/dbt_yfdash/models/example/my_second_dbt_model.sql
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
-- Use the `ref` function to select from other models
|
3 |
+
|
4 |
+
select *
|
5 |
+
from {{ ref('my_first_dbt_model') }}
|
6 |
+
where id = 1
|
src/dbt_yfdash/models/example/schema.yml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
version: 2
|
3 |
+
|
4 |
+
models:
|
5 |
+
- name: my_first_dbt_model
|
6 |
+
description: "A starter dbt model"
|
7 |
+
columns:
|
8 |
+
- name: id
|
9 |
+
description: "The primary key for this table"
|
10 |
+
data_tests:
|
11 |
+
- unique
|
12 |
+
- not_null
|
13 |
+
|
14 |
+
- name: my_second_dbt_model
|
15 |
+
description: "A starter dbt model"
|
16 |
+
columns:
|
17 |
+
- name: id
|
18 |
+
description: "The primary key for this table"
|
19 |
+
data_tests:
|
20 |
+
- unique
|
21 |
+
- not_null
|
src/dbt_yfdash/seeds/.gitkeep
ADDED
File without changes
|
src/dbt_yfdash/snapshots/.gitkeep
ADDED
File without changes
|
src/dbt_yfdash/tests/.gitkeep
ADDED
File without changes
|
src/profile.yml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
default:
|
2 |
+
outputs:
|
3 |
+
dev:
|
4 |
+
type: duckdb
|
5 |
+
target: dev
|