generated from dbt-labs/dbt-cloud-snowflake-demo-template
-
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.
- Loading branch information
Showing
7 changed files
with
132 additions
and
4 deletions.
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
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,22 @@ | ||
{{ | ||
config( | ||
materialized='table' | ||
) | ||
}} | ||
|
||
with data as ( | ||
|
||
select | ||
product_key, | ||
brand, | ||
category_name, | ||
product_name, | ||
_fivetran_synced | ||
from | ||
{{ ref("stg_products") }} | ||
) | ||
|
||
select | ||
* | ||
from | ||
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,20 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: google_sheets | ||
database: fivetran_database | ||
tables: | ||
- name: fragrance_products | ||
columns: | ||
- name: _row | ||
data_type: number | ||
- name: brand | ||
data_type: varchar | ||
- name: category | ||
data_type: varchar | ||
- name: product_name | ||
data_type: varchar | ||
- name: product_key | ||
data_type: number | ||
- name: _fivetran_synced | ||
data_type: timestamp_tz |
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,31 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stg_products | ||
description: table with all fragrance and flavor related products | ||
columns: | ||
- name: product_key | ||
data_type: number | ||
description: unique identified for products | ||
tests: | ||
- unique | ||
- not_null | ||
|
||
- name: brand | ||
data_type: varchar | ||
description: brand of product | ||
|
||
- name: category_name | ||
data_type: varchar | ||
description: category name - valid options include Beauty, Food, or Chemical | ||
tests: | ||
- accepted_values: | ||
values: ['Beauty','Food','Chemical','Other'] | ||
|
||
- name: product_name | ||
data_type: varchar | ||
description: name of product | ||
|
||
- name: _fivetran_synced | ||
data_type: timestamp_tz | ||
description: time record synced via Fivetran |
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,31 @@ | ||
with | ||
|
||
source as ( | ||
|
||
select | ||
* | ||
from | ||
{{ source("google_sheets", "fragrance_products") }} | ||
), | ||
|
||
renamed as ( | ||
|
||
select | ||
product_key, | ||
brand, | ||
decode( | ||
category, | ||
'B', 'Beauty', | ||
'C', 'Chemical', | ||
'F', 'Food', | ||
'Other' | ||
) as category_name, | ||
product_name, | ||
_fivetran_synced | ||
|
||
from source | ||
|
||
) | ||
|
||
select * | ||
from renamed |
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