mirror of
https://github.com/FlipsideCrypto/sei-models.git
synced 2026-02-06 15:36:45 +00:00
tags, merge predicates
This commit is contained in:
parent
f2aab061c7
commit
e1149d1d36
8
macros/dbt/get_tmp_relation_type.sql
Normal file
8
macros/dbt/get_tmp_relation_type.sql
Normal file
@ -0,0 +1,8 @@
|
||||
{% macro dbt_snowflake_get_tmp_relation_type(
|
||||
strategy,
|
||||
unique_key,
|
||||
language
|
||||
) %}
|
||||
-- always table
|
||||
{{ return('table') }}
|
||||
{% endmacro %}
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'PRICE' }} }
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'PRICE' }} },
|
||||
tags = ['daily']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'SWAPS' }} }
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'SWAPS' }} },
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} }
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -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') }}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }}}
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} }
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STAKING' }} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
materialized = 'view',
|
||||
tags = ['daily']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'table'
|
||||
materialized = 'table',
|
||||
tags = ['daily']
|
||||
) }}
|
||||
|
||||
WITH base AS (
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
unique_key = "block_id",
|
||||
incremental_strategy = 'merge',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
WITH base AS (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "address",
|
||||
incremental_strategy = 'merge'
|
||||
incremental_strategy = 'merge',
|
||||
tags = ['daily']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
materialized = 'incremental',
|
||||
unique_key = 'pool_id',
|
||||
incremental_strategy = 'merge',
|
||||
enabled = true
|
||||
enabled = true,
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
unique_key = "tx_id",
|
||||
incremental_strategy = 'merge',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
WITH
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "_inserted_timestamp",
|
||||
incremental_strategy = 'delete+insert'
|
||||
incremental_strategy = 'delete+insert',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user