start project
This commit is contained in:
parent
82b9adb085
commit
727431b7b2
13 changed files with 1432 additions and 23 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
target/
|
||||||
|
dbt_packages/
|
||||||
|
logs/
|
||||||
33
README.md
33
README.md
|
|
@ -1,26 +1,15 @@
|
||||||
# DWH dbt project
|
Welcome to your new dbt project!
|
||||||
|
|
||||||
Welcome to the dbt project for our DWH.
|
### Using the starter project
|
||||||
|
|
||||||
## Prepare your environment
|
Try running the following commands:
|
||||||
|
- dbt run
|
||||||
- Requirements
|
- dbt test
|
||||||
- You should either use a pure Linux env, work on macOS or use WSL2.
|
|
||||||
- You will need Python >=3.10 and `poetry` installed.
|
|
||||||
- Clone this repository and checkout the `master` branch.
|
|
||||||
|
|
||||||
|
|
||||||
## Branching strategy
|
### Resources:
|
||||||
|
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
|
||||||
#TODO
|
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
|
||||||
|
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
|
||||||
|
- Find [dbt events](https://events.getdbt.com) near you
|
||||||
## Deploying changes in DWH
|
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices
|
||||||
|
|
||||||
#TODO
|
|
||||||
|
|
||||||
|
|
||||||
## Initial setup
|
|
||||||
|
|
||||||
- dbt init
|
|
||||||
- Set up profiles.yaml
|
|
||||||
|
|
|
||||||
0
analyses/.gitkeep
Normal file
0
analyses/.gitkeep
Normal file
37
dbt_project.yml
Normal file
37
dbt_project.yml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
# Name your project! Project names should contain only lowercase characters
|
||||||
|
# and underscores. A good package name should reflect your organization's
|
||||||
|
# name or the intended use of these models
|
||||||
|
name: 'dwh_dbt'
|
||||||
|
version: '1.0.0'
|
||||||
|
config-version: 2
|
||||||
|
|
||||||
|
# This setting configures which "profile" dbt uses for this project.
|
||||||
|
profile: 'dwh_dbt'
|
||||||
|
|
||||||
|
# These configurations specify where dbt should look for different types of files.
|
||||||
|
# The `model-paths` config, for example, states that models in this project can be
|
||||||
|
# found in the "models/" directory. You probably won't need to change these!
|
||||||
|
model-paths: ["models"]
|
||||||
|
analysis-paths: ["analyses"]
|
||||||
|
test-paths: ["tests"]
|
||||||
|
seed-paths: ["seeds"]
|
||||||
|
macro-paths: ["macros"]
|
||||||
|
snapshot-paths: ["snapshots"]
|
||||||
|
|
||||||
|
clean-targets: # directories to be removed by `dbt clean`
|
||||||
|
- "target"
|
||||||
|
- "dbt_packages"
|
||||||
|
|
||||||
|
|
||||||
|
# Configuring models
|
||||||
|
# Full documentation: https://docs.getdbt.com/docs/configuring-models
|
||||||
|
|
||||||
|
# In this example config, we tell dbt to build all models in the example/
|
||||||
|
# directory as views. These settings can be overridden in the individual model
|
||||||
|
# files using the `{{ config(...) }}` macro.
|
||||||
|
models:
|
||||||
|
dwh_dbt:
|
||||||
|
# Config indicated by + and applies to all files under models/example/
|
||||||
|
example:
|
||||||
|
+materialized: view
|
||||||
0
macros/.gitkeep
Normal file
0
macros/.gitkeep
Normal file
27
models/example/my_first_dbt_model.sql
Normal file
27
models/example/my_first_dbt_model.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Welcome to your first dbt model!
|
||||||
|
Did you know that you can also configure models directly within SQL files?
|
||||||
|
This will override configurations stated in dbt_project.yml
|
||||||
|
|
||||||
|
Try changing "table" to "view" below
|
||||||
|
*/
|
||||||
|
|
||||||
|
{{ config(materialized='table') }}
|
||||||
|
|
||||||
|
with source_data as (
|
||||||
|
|
||||||
|
select 1 as id
|
||||||
|
union all
|
||||||
|
select null as id
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
select *
|
||||||
|
from source_data
|
||||||
|
|
||||||
|
/*
|
||||||
|
Uncomment the line below to remove records with null `id` values
|
||||||
|
*/
|
||||||
|
|
||||||
|
-- where id is not null
|
||||||
6
models/example/my_second_dbt_model.sql
Normal file
6
models/example/my_second_dbt_model.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
-- Use the `ref` function to select from other models
|
||||||
|
|
||||||
|
select *
|
||||||
|
from {{ ref('my_first_dbt_model') }}
|
||||||
|
where id = 1
|
||||||
21
models/example/schema.yml
Normal file
21
models/example/schema.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
models:
|
||||||
|
- name: my_first_dbt_model
|
||||||
|
description: "A starter dbt model"
|
||||||
|
columns:
|
||||||
|
- name: id
|
||||||
|
description: "The primary key for this table"
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: my_second_dbt_model
|
||||||
|
description: "A starter dbt model"
|
||||||
|
columns:
|
||||||
|
- name: id
|
||||||
|
description: "The primary key for this table"
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
1325
poetry.lock
generated
Normal file
1325
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "data-dwh-dbt-project"
|
name = "data-dwh-dbt-project"
|
||||||
version = "dev"
|
version = "0.1.0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Pablo Martin <pablo.martin@superhog.com>"]
|
authors = ["Pablo Martin <pablo.martin@superhog.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
0
seeds/.gitkeep
Normal file
0
seeds/.gitkeep
Normal file
0
snapshots/.gitkeep
Normal file
0
snapshots/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
Loading…
Add table
Add a link
Reference in a new issue