tags, merge predicates

This commit is contained in:
Eric Laurello 2023-11-09 08:50:04 -05:00
parent f2aab061c7
commit e1149d1d36
52 changed files with 121 additions and 61 deletions

View File

@ -0,0 +1,8 @@
{% macro dbt_snowflake_get_tmp_relation_type(
strategy,
unique_key,
language
) %}
-- always table
{{ return('table') }}
{% endmacro %}

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'PRICE' }} }
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'PRICE' }} },
tags = ['daily']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['core']
) }}
SELECT

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'SWAPS' }} }
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'SWAPS' }} },
tags = ['core']
) }}

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['noncore']
) }}
SELECT

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} }
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} },
tags = ['noncore']
) }}
SELECT

View File

@ -1,22 +1,18 @@
{{ config(
materialized = 'view',
meta={
'database_tags':{
'table': {
'PURPOSE': 'GOVERNANCE'
}
}
}
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} },
tags = ['noncore']
) }}
SELECT
block_id,
block_timestamp,
tx_id,
SELECT
block_id,
block_timestamp,
tx_id,
tx_succeeded,
proposer,
proposal_id,
proposal_type,
proposal_title,
proposer,
proposal_id,
proposal_type,
proposal_title,
proposal_description
FROM {{ ref('silver__governance_submit_proposal') }}
FROM
{{ ref('silver__governance_submit_proposal') }}

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} },
tags = ['noncore']
) }}
SELECT

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }}}
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} },
tags = ['noncore']
) }}
SELECT

View File

@ -1,6 +1,7 @@
{{ config(
materialized = 'view',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} }
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} },
tags = ['noncore']
) }}
SELECT

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'view'
materialized = 'view',
tags = ['daily']
) }}
SELECT

View File

@ -3,7 +3,8 @@
unique_key = ['date', 'address', 'currency'],
incremental_strategy = 'merge',
cluster_by = ['DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address);"
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address);",
tags = ['daily']
) }}
WITH all_staked AS (

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'table'
materialized = 'table',
tags = ['daily']
) }}
WITH base AS (

View File

@ -3,6 +3,7 @@
unique_key = "block_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH base AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = "block_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE'],
tags = ['core']
) }}
-- depends_on: {{ ref('bronze__streamline_blocks') }}
WITH base AS (

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "contract_address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['noncore']
) }}
SELECT

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "contract_address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['noncore']
) }}
SELECT

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "contract_address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['noncore']
) }}
SELECT

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "contract_address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['noncore']
) }}
SELECT

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "contract_address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['noncore']
) }}
SELECT

View File

@ -1,9 +1,11 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = ["tx_id","msg_index","attribute_index"],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_id,msg_type,attribute_key,attribute_value);"
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_id,msg_type,attribute_key,attribute_value);",
tags = ['core']
) }}
SELECT

View File

@ -1,9 +1,11 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = ["tx_id","msg_index"],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(msg_type, msg:attributes);"
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(msg_type, msg:attributes);",
tags = ['core']
) }}
WITH b AS (

View File

@ -1,8 +1,10 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = "_unique_key",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['daily']
) }}
WITH base_ma AS (

View File

@ -1,8 +1,10 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = "tx_id",
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['core']
) }}
-- depends_on: {{ ref('bronze__streamline_transactions') }}
WITH base_table AS (

View File

@ -1,8 +1,10 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = "tx_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE'],
tags = ['core']
) }}
WITH atts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['core']
) }}
WITH base_atts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['core']
) }}
WITH base_atts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['core']
) }}
WITH base_atts AS (

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "address",
incremental_strategy = 'merge'
incremental_strategy = 'merge',
tags = ['daily']
) }}
SELECT

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = 'pool_id',
incremental_strategy = 'merge',
enabled = true
enabled = true,
tags = ['noncore']
) }}
SELECT

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -3,7 +3,8 @@
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
enabled = true
enabled = true,
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE','lp_action']
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE','lp_action'],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH rel_contracts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH all_contacts AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ['tx_id','msg_index'],
incremental_strategy = 'merge',
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ]
cluster_by = ['_inserted_timestamp::DATE', 'block_timestamp::DATE' ],
tags = ['noncore']
) }}
WITH all_contacts AS (

View File

@ -3,6 +3,7 @@
unique_key = "tx_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = "tx_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH

View File

@ -1,8 +1,10 @@
{{ config(
materialized = 'incremental',
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::DATE >= (select min(block_timestamp::DATE) from ' ~ generate_tmp_view_name(this) ~ ')'],
unique_key = "_unique_key",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH base_ma AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = "_unique_key",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH pre_base AS (

View File

@ -3,6 +3,7 @@
unique_key = "_unique_key",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
{# select 1 a #}
WITH msg_attributes AS (

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
unique_key = ["tx_id","msg_group","msg_sub_group"],
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
cluster_by = ['block_timestamp::DATE'],
tags = ['noncore']
) }}
WITH txs AS (

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "_inserted_timestamp",
incremental_strategy = 'delete+insert'
incremental_strategy = 'delete+insert',
tags = ['noncore']
) }}
SELECT