move sources to bronze

This commit is contained in:
Jack Forgash 2023-05-04 13:40:19 -06:00
parent 1ce6f7cf8f
commit 11676ce493
6 changed files with 166 additions and 12 deletions

View File

@ -0,0 +1,21 @@
{{ config(
materialized = 'view'
) }}
SELECT
system_created_at,
blockchain,
address,
creator,
label_type,
label_subtype,
address_name,
project_name,
insert_date AS _load_timestamp
FROM
{{ source(
'crosschain',
'address_labels'
) }}
WHERE
blockchain = 'near'

View File

@ -0,0 +1,46 @@
{{ config(
materialized = 'view'
) }}
SELECT
date_day,
prior_date_day,
next_date_day,
prior_year_date_day,
prior_year_over_year_date_day,
day_of_week,
day_of_week_iso,
day_of_week_name,
day_of_week_name_short,
day_of_month,
day_of_year,
week_start_date,
week_end_date,
prior_year_week_start_date,
prior_year_week_end_date,
week_of_year,
iso_week_start_date,
iso_week_end_date,
prior_year_iso_week_start_date,
prior_year_iso_week_end_date,
iso_week_of_year,
prior_year_week_of_year,
prior_year_iso_week_of_year,
month_of_year,
month_name,
month_name_short,
month_start_date,
month_end_date,
prior_year_month_start_date,
prior_year_month_end_date,
quarter_of_year,
quarter_start_date,
quarter_end_date,
year_number,
year_start_date,
year_end_date
FROM
{{ source(
'crosschain',
'dim_dates'
) }}

View File

@ -12,12 +12,7 @@ SELECT
project_name,
label_type,
label_subtype,
label_type AS l1_label,
label_subtype AS l2_label
l1_label,
l2_label
FROM
{{ source(
'crosschain',
'address_labels'
) }}
WHERE
blockchain = 'near'
{{ ref('silver__address_labels') }}

View File

@ -27,10 +27,7 @@ dates AS (
SELECT
date_day
FROM
{{ source(
'crosschain',
'dim_dates'
) }}
{{ ref('silver__dates') }}
WHERE
date_day >= '2020-08-25'
AND date_day < CURRENT_DATE

View File

@ -0,0 +1,44 @@
{{ config(
materialized = 'incremental',
unique_key = 'address',
cluster_by = 'address'
) }}
WITH address_labels AS (
SELECT
system_created_at,
blockchain,
address,
creator,
label_type,
label_subtype,
address_name,
project_name,
_load_timestamp
FROM
{{ ref('bronze__address_labels') }}
{% if is_incremental() %}
WHERE
_load_timestamp >= (
SELECT
MAX(_load_timestamp)
FROM
{{ this }}
)
{% endif %}
)
SELECT
system_created_at,
blockchain,
address,
address_name,
project_name,
label_type,
label_subtype,
label_type AS l1_label,
label_subtype AS l2_label,
_load_timestamp
FROM
address_labels

View File

@ -0,0 +1,51 @@
{{ config(
materialized = 'table',
unique_key = 'date_day'
) }}
WITH dim_dates AS (
SELECT
date_day,
prior_date_day,
next_date_day,
prior_year_date_day,
prior_year_over_year_date_day,
day_of_week,
day_of_week_iso,
day_of_week_name,
day_of_week_name_short,
day_of_month,
day_of_year,
week_start_date,
week_end_date,
prior_year_week_start_date,
prior_year_week_end_date,
week_of_year,
iso_week_start_date,
iso_week_end_date,
prior_year_iso_week_start_date,
prior_year_iso_week_end_date,
iso_week_of_year,
prior_year_week_of_year,
prior_year_iso_week_of_year,
month_of_year,
month_name,
month_name_short,
month_start_date,
month_end_date,
prior_year_month_start_date,
prior_year_month_end_date,
quarter_of_year,
quarter_start_date,
quarter_end_date,
year_number,
year_start_date,
year_end_date
FROM
{{ ref('bronze__dates') }}
)
SELECT
*
FROM
dim_dates