start project

This commit is contained in:
Pablo Martin 2024-01-18 11:24:35 +01:00
parent 82b9adb085
commit 727431b7b2
13 changed files with 1432 additions and 23 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
target/
dbt_packages/
logs/

View file

@ -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
- Requirements
- 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.
Try running the following commands:
- dbt run
- dbt test
## Branching strategy
#TODO
## Deploying changes in DWH
#TODO
## Initial setup
- dbt init
- Set up profiles.yaml
### Resources:
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
- 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
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices

0
analyses/.gitkeep Normal file
View file

37
dbt_project.yml Normal file
View 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
View file

View 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

View 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
View 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

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "data-dwh-dbt-project"
version = "dev"
version = "0.1.0"
description = ""
authors = ["Pablo Martin <pablo.martin@superhog.com>"]
readme = "README.md"

0
seeds/.gitkeep Normal file
View file

0
snapshots/.gitkeep Normal file
View file

0
tests/.gitkeep Normal file
View file