-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from lironesamoun/dbt/models
(dbt) Add first dbt model for data
- Loading branch information
Showing
5 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: production | ||
database: de-capstone-project-23 | ||
schema: globalterrorism_raw | ||
tables: | ||
- name: data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{ config(materialized="table") }} | ||
|
||
select | ||
eventid as event_id, | ||
case when iday != 0 then cast(concat(iyear, '-', imonth, '-', iday) as date) else null end as event_date, | ||
country_txt as country, | ||
region_txt as region, | ||
provstate, | ||
city, | ||
summary, | ||
cast(crit1 as integer) as reason1, | ||
cast(crit2 as integer) as reason2, | ||
cast(crit3 as integer) as reason3, | ||
cast(doubtterr as integer) as doubt_terrorism_proper, | ||
attacktype1_txt as attack_type, | ||
targtype1_txt as target_type, | ||
weaptype1_txt as weapon_type, | ||
gname as perpetrator_group_name, | ||
cast(nkill as integer) as nkill, | ||
cast(nwound as integer) as nwound, | ||
cast(ishostkid as integer) as ishostkid, | ||
cast(nhostkid as integer) as nhostkid | ||
from {{ source("staging", "data") }} | ||
|
||
{% if var("is_test_run", default=true) %} limit 100 {% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: staging | ||
database: de-capstone-project-23 | ||
schema: globalterrorism_raw | ||
tables: | ||
- name: data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
packages: | ||
- package: dbt-labs/dbt_utils | ||
version: 1.0.0 | ||
- package: calogica/dbt_date | ||
version: 0.7.2 |