Skip to content

Commit

Permalink
seeds update
Browse files Browse the repository at this point in the history
first staging models
  • Loading branch information
bergalli committed Apr 29, 2024
1 parent a14017b commit 886302e
Show file tree
Hide file tree
Showing 41 changed files with 1,260,174 additions and 1,257,548 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
workspace/
.user.yml
profiles.yml
target/
Expand Down
2 changes: 2 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sqlfluff]
dialect = ansi
48 changes: 43 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
Welcome to your new dbt project!
### Format sql files

### Using the starter project
`pip install sqlfluff`

Try running the following commands:
- dbt run
- dbt test
```
sqlfluff fix --dialect ansi ./models
```


### Setup the project's DB

1. Locate the profiles.yaml File
The profiles.yaml file is typically located in the .dbt directory in the user's home folder. If it doesn’t exist, the developer will need to create it. The location should be:

On Unix-based systems (Linux, MacOS): ~/.dbt/profiles.yaml
On Windows: %USERPROFILE%\.dbt\profiles.yaml

2. Create or Modify the profiles.yaml File :

```yaml
crispy_dataprep:
target: dev
outputs:
dev:
type: postgres
threads: 1
host: hostname
port: 5432
user: username
pass: password
dbname: dbname
schema: schema_name
```
3. Initialize the data sources :
`dbt seed --full-refresh`

### DBT commands

```sh
dbt run
dbt test
dbt docs generate && dbt docs serve
```


### Resources:
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ clean-targets: # directories to be removed by `dbt clean`
models:
crispy_dataprep:
# Config indicated by + and applies to all files under models/example/
example:
staging:
+materialized: view
Binary file added models/.DS_Store
Binary file not shown.
Binary file added models/staging/.DS_Store
Binary file not shown.
25 changes: 25 additions & 0 deletions models/staging/capacity_factors_data/staging_capfac_ipr.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SELECT
variable_class,
sub_variable_class_1,
sub_variable_class_2,
scenario,
region,
sector,
units,
year,
value
FROM {{ ref('raw_capacity_factors_IPR2021') }}

UNION ALL

SELECT
scenario,
region,
variable_class,
sub_variable_class_1,
sub_variable_class_2,
sector,
units,
year,
value
FROM {{ ref('raw_capacity_factors_IPR2023') }}
25 changes: 25 additions & 0 deletions models/staging/price_data_long_data/staging_price_ipr.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SELECT
scenario,
region,
variable_class,
sub_variable_class_1,
NULL as sub_variable_class_2, -- Placeholder for the extra column
NULL as sector, -- Placeholder for the extra column
units,
year,
value
FROM {{ ref('raw_price_data_long_IPR2021') }}

UNION ALL

SELECT
scenario,
region,
variable_class,
sub_variable_class_1,
sub_variable_class_2,
sector,
units,
year,
value
FROM {{ ref('raw_price_data_long_IPR2023') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SELECT
scenario,
region,
sector,
units,
variable_class,
sub_variable_class_1,
sub_variable_class_2,
year,
value
FROM {{ ref('ipr_Scenarios_AnalysisInput') }}

UNION ALL

SELECT
scenario,
region,
variable_class,
sub_variable_class_1,
sub_variable_class_2,
sector,
units,
year,
value
FROM {{ ref('ipr2023_Scenarios_AnalysisInput') }}
Binary file added seeds/.DS_Store
Binary file not shown.
2,944 changes: 1,472 additions & 1,472 deletions seeds/capacity_factors_data/WEO2020_Raw_data.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
year,technology,value
year,technology,value
2021,Crude Steel ,0.592794894
2021,BOF Steel,0.622848035
2021,EAF Steel,0.636920856
2021,OHF Steel,0.926829268
2021,Iron,0.62425383
2021,BF,0.675152043
2021,DRI,0.461395189
2021,DRI,0.461395189
70,930 changes: 35,465 additions & 35,465 deletions seeds/capacity_factors_data/raw_capacity_factors_IPR2021.csv

Large diffs are not rendered by default.

35,466 changes: 17,733 additions & 17,733 deletions seeds/capacity_factors_data/raw_capacity_factors_IPR2023.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 886302e

Please sign in to comment.