This commit is contained in:
Eric Laurello 2023-12-05 12:25:20 -05:00
parent ca710bfdc2
commit a78283151c
120 changed files with 500 additions and 162 deletions

View File

@ -2,6 +2,7 @@ name: dbt_run_dev_refresh
run-name: dbt_run_dev_refresh
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'

View File

@ -38,4 +38,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt test -m ./models
dbt test -m models/bronze models/silver models/gold

View File

@ -8,67 +8,36 @@ as
$$
snowflake.execute({sqlText: `BEGIN TRANSACTION;`});
try {
snowflake.execute({sqlText: `DROP DATABASE IF EXISTS ${DESTINATION_DB_NAME}`});
snowflake.execute({sqlText: `CREATE DATABASE ${DESTINATION_DB_NAME} CLONE ${SOURCE_DB_NAME}`});
snowflake.execute({sqlText: `DROP SCHEMA ${DESTINATION_DB_NAME}._INTERNAL`}); /* this only needs to be in prod */
snowflake.execute({sqlText: `CREATE OR REPLACE DATABASE ${DESTINATION_DB_NAME} CLONE ${SOURCE_DB_NAME}`});
snowflake.execute({sqlText: `DROP SCHEMA IF EXISTS ${DESTINATION_DB_NAME}._INTERNAL`}); /* this only needs to be in prod */
var existing_schemas = snowflake.execute({sqlText: `SELECT table_schema
FROM ${DESTINATION_DB_NAME}.INFORMATION_SCHEMA.TABLE_PRIVILEGES
WHERE grantor IS NOT NULL
GROUP BY 1;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL SCHEMAS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL FUNCTIONS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL PROCEDURES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL VIEWS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL STAGES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL TABLES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE FUNCTIONS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE PROCEDURES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE VIEWS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE STAGES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE TABLES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`});
while (existing_schemas.next()) {
var schema = existing_schemas.getColumnValue(1)
snowflake.execute({sqlText: `GRANT OWNERSHIP ON SCHEMA ${DESTINATION_DB_NAME}.${schema} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
snowflake.execute({sqlText: `GRANT OWNERSHIP ON DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`})
var existing_tags = snowflake.execute({sqlText: `SHOW TAGS IN DATABASE ${DESTINATION_DB_NAME};`});
while (existing_tags.next()) {
var schema = existing_tags.getColumnValue(4);
var tag_name = existing_tags.getColumnValue(2)
snowflake.execute({sqlText: `GRANT OWNERSHIP ON TAG ${DESTINATION_DB_NAME}.${schema}.${tag_name} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
}
var existing_tables = snowflake.execute({sqlText: `SELECT table_schema, table_name
FROM ${DESTINATION_DB_NAME}.INFORMATION_SCHEMA.TABLE_PRIVILEGES
WHERE grantor IS NOT NULL
GROUP BY 1,2;`});
while (existing_tables.next()) {
var schema = existing_tables.getColumnValue(1)
var table_name = existing_tables.getColumnValue(2)
snowflake.execute({sqlText: `GRANT OWNERSHIP ON TABLE ${DESTINATION_DB_NAME}.${schema}.${table_name} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`});
}
var existing_functions = snowflake.execute({sqlText: `SELECT function_schema, function_name, concat('(',array_to_string(regexp_substr_all(argument_signature, 'VARCHAR|NUMBER|FLOAT|ARRAY|VARIANT|OBJECT|DOUBLE|BOOLEAN'),','),')') as argument_signature
FROM ${DESTINATION_DB_NAME}.INFORMATION_SCHEMA.FUNCTIONS;`});
while (existing_functions.next()) {
var schema = existing_functions.getColumnValue(1)
var function_name = existing_functions.getColumnValue(2)
var argument_signature = existing_functions.getColumnValue(3)
snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUNCTION ${DESTINATION_DB_NAME}.${schema}.${function_name}${argument_signature} to role ${ROLE_NAME} REVOKE CURRENT GRANTS;`});
}
var existing_procedures = snowflake.execute({sqlText: `SELECT procedure_schema, procedure_name, concat('(',array_to_string(regexp_substr_all(argument_signature, 'VARCHAR|NUMBER|FLOAT|ARRAY|VARIANT|OBJECT|DOUBLE|BOOLEAN'),','),')') as argument_signature
FROM ${DESTINATION_DB_NAME}.INFORMATION_SCHEMA.PROCEDURES;`});
while (existing_procedures.next()) {
var schema = existing_procedures.getColumnValue(1)
var procedure_name = existing_procedures.getColumnValue(2)
var argument_signature = existing_procedures.getColumnValue(3)
snowflake.execute({sqlText: `GRANT OWNERSHIP ON PROCEDURE ${DESTINATION_DB_NAME}.${schema}.${procedure_name}${argument_signature} to role ${ROLE_NAME} REVOKE CURRENT GRANTS;`});
}
var existing_tasks = snowflake.execute({sqlText: `SHOW TASKS IN DATABASE ${DESTINATION_DB_NAME};`});
while (existing_tasks.next()) {
var schema = existing_tasks.getColumnValue(5)
var task_name = existing_tasks.getColumnValue(2)
snowflake.execute({sqlText: `ALTER TASK ${DESTINATION_DB_NAME}.${schema}.${task_name} SUSPEND;`})
snowflake.execute({sqlText: `GRANT OWNERSHIP ON TASK ${DESTINATION_DB_NAME}.${schema}.${task_name} to role ${ROLE_NAME} REVOKE CURRENT GRANTS;`});
}
snowflake.execute({sqlText: `GRANT OWNERSHIP ON DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`})
snowflake.execute({sqlText: `COMMIT;`});
} catch (err) {
snowflake.execute({sqlText: `ROLLBACK;`});
throw(err);
}
return true
$$

View File

@ -0,0 +1,5 @@
{% docs inserted_timestamp %}
The utc timestamp at which the row was inserted into the table.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs modified_timestamp %}
The utc timestamp at which the row was last modified.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs pk %}
The unique identifier for each row in the table.
{% enddocs %}

View File

@ -24,7 +24,9 @@ SELECT
HASH,
agg_state,
_INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
{{ ref('silver__block_log') }}
@ -57,7 +59,9 @@ SELECT
NULL AS HASH,
NULL AS agg_state,
'1900-01-01' :: DATE AS _inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
'1900-01-01' :: DATE AS inserted_timestamp,
'1900-01-01' :: DATE AS modified_timestamp
UNION ALL
SELECT
'-2' AS dim_block_id,
@ -76,4 +80,6 @@ SELECT
NULL AS HASH,
NULL AS agg_state,
'1900-01-01' :: DATE AS _inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
'1900-01-01' :: DATE AS inserted_timestamp,
'1900-01-01' :: DATE AS modified_timestamp

View File

@ -59,6 +59,10 @@ models:
where: DIM_BLOCK_ID not in ('-1','-2')
- name: agg_state
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: DIM_BLOCK_ID

View File

@ -3,12 +3,18 @@
) }}
SELECT
{{ dbt_utils.generate_surrogate_key(
[' address ']
) }} AS dim_labels_id,
blockchain,
creator,
address,
label_type,
label_subtype,
project_name AS label,
address_name AS address_name
address_name AS address_name,
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
{{ ref('silver__croschain_labels') }}

View File

@ -28,4 +28,8 @@ models:
- name: ADDRESS
description: Address that the label is for. This is the field that should be used to join other tables with labels.
tests:
- not_null
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -39,7 +39,10 @@ SELECT
) AS dim_block_id,
version,
event_id,
A._INSERTED_TIMESTAMP
A._INSERTED_TIMESTAMP,
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -22,6 +22,10 @@ models:
description: "The network version"
- name: EVENT_ID
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_NETWORK_VERSION_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_set_mimir_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -41,7 +41,9 @@ SELECT
key,
VALUE,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -22,6 +22,10 @@ models:
description: ""
- name: VALUE
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_SET_MIMIR_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_thorname_change_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -51,7 +51,9 @@ SELECT
fund_amount_e8,
registration_fee_e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -32,6 +32,10 @@ models:
description: ""
- name: REGISTRATION_FEE_E8
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_THORNAME_CHANGE_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_transfer_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -45,7 +45,9 @@ SELECT
asset,
amount_e8,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -34,6 +34,10 @@ models:
description: "The asset amount for this event"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_TRANSFER_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_transfers_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -47,7 +47,9 @@ SELECT
rune_amount,
rune_amount_usd,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -38,6 +38,10 @@ models:
description: "The transferred RUNE amount in USD"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_TRANSFERS_ID

View File

@ -48,7 +48,9 @@ SELECT
height,
event_id,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -28,6 +28,10 @@ models:
description: "The round of the event"
- name: height
description: "The height of the event"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: fact_tss_keygen_failure_events_id

View File

@ -44,7 +44,9 @@ SELECT
height,
event_id,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -24,6 +24,10 @@ models:
description: "the members involved in the keygen"
- name: height
description: "The height of the event"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: fact_tss_keygen_success_events_id

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_active_vault_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -47,7 +47,9 @@ SELECT
) AS dim_block_id,
add_asgard_addr,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -22,6 +22,10 @@ models:
description: "The asgard address added to the vault"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_ACTIVE_VAULT_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_add_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -64,7 +64,9 @@ SELECT
A.from_address,
A.asset,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -45,6 +45,10 @@ models:
description: "{{ doc('from_address') }}"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_ADD_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_asgard_fund_yggdrasil_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -53,7 +53,9 @@ SELECT
A.vault_key,
A.asset_e8,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -33,6 +33,10 @@ models:
- name: ASSET_E8
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_ASGARD_FUND_YGGDRASIL_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_depths_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -52,7 +52,9 @@ SELECT
synth_e8,
pool_name,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -34,6 +34,10 @@ models:
description: "{{ doc('pool_name') }}"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_DEPTHS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_block_rewards_id',
incremental_strategy = 'merge'
) }}
@ -43,6 +43,8 @@ SELECT
liquidity_earnings,
avg_node_count,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -35,6 +35,10 @@ models:
- not_null
- name: AVG_NODE_COUNT
description: "The summarized average node operators number within this day"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_BLOCK_REWARDS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = "fact_bond_actions_id",
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -75,7 +75,9 @@ SELECT
) AS asset_usd,
memo,
be._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
bond_events be
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -53,7 +53,10 @@ models:
- not_null
- name: MEMO
description: "{{ doc('memo') }}"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_BOND_ACTIONS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_bond_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -62,7 +62,9 @@ SELECT
bond_type,
e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -54,7 +54,11 @@ models:
- name: E8
description: "The rune amount for this bond event"
tests:
- not_null
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_BOND_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_daily_earnings_id',
incremental_strategy = 'merge'
) }}
@ -53,6 +53,8 @@ SELECT
earnings_to_pools_usd,
avg_node_count,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -55,6 +55,10 @@ models:
- not_null
- name: AVG_NODE_COUNT
description: "The summarized average node operators number within this day"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_DAILY_EARNINGS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_daily_pool_stats_id',
incremental_strategy = 'merge',
cluster_by = ['day']
@ -107,6 +107,8 @@ SELECT
unique_member_count,
unique_swapper_count,
liquidity_units,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -88,6 +88,10 @@ models:
description: "The unique swap address for this pool"
- name: LIQUIDITY_UNITS
description: "The amount of units for the liquidity in the pool"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_DAILY_POOL_STATS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_daily_tvl_id',
incremental_strategy = 'merge',
cluster_by = ['day']
@ -42,6 +42,8 @@ SELECT
total_value_bonded_usd,
total_value_locked,
total_value_locked_usd,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -24,6 +24,10 @@ models:
description: "The total rune value locked in the pool"
- name: TOTAL_VALUE_LOCKED_USD
description: "The total USD value locked in the pool"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_DAILY_TVL_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_errata_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -53,7 +53,9 @@ SELECT
in_tx,
asset,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -34,6 +34,10 @@ models:
description: "Asset name"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_ERRATA_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_fee_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -53,7 +53,9 @@ SELECT
pool_deduct,
asset_e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -34,6 +34,10 @@ models:
description: "The asset amount for this fee, using the price table we can calculate the rune amount by asset amount"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_FEE_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_gas_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -53,7 +53,9 @@ SELECT
rune_e8,
tx_count,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -33,7 +33,11 @@ models:
- name: TX_COUNT
description: "The total count of transactions within this block id"
tests:
- not_null
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_GAS_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_inactive_vault_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -47,7 +47,9 @@ SELECT
) AS dim_block_id,
add_asgard_address,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -22,6 +22,10 @@ models:
description: "The asgard address in the vault which are inactive"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_INACTIVE_VAULT_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_liquidity_actions_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -71,7 +71,9 @@ SELECT
unstake_asymmetry,
unstake_basis_points,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -65,6 +65,10 @@ models:
description: "Only exists in unstake, or removing the liquidity"
- name: unstake_basis_points
description: "The basis points for unstaking, or removing the liquidity"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_LIQUIDITY_ACTIONS_ID

View File

@ -52,7 +52,10 @@ SELECT
collateral_asset,
target_asset,
event_id,
A._INSERTED_TIMESTAMP
A._INSERTED_TIMESTAMP,
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -46,6 +46,10 @@ models:
description: "The amount of debt issued"
- name: tx_id
description: "The transaction ID"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_LOAN_OPEN_EVENTS_ID

View File

@ -51,7 +51,10 @@ SELECT
debt_repaid,
tx_id,
event_id,
A._INSERTED_TIMESTAMP
A._INSERTED_TIMESTAMP,
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -38,6 +38,10 @@ models:
description: "The amount of debt repayed"
- name: tx_id
description: "The transaction ID"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_LOAN_REPAYMENT_EVENTS_ID

View File

@ -45,7 +45,10 @@ SELECT
supply,
reason,
event_id,
A._INSERTED_TIMESTAMP
A._INSERTED_TIMESTAMP,
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -28,6 +28,10 @@ models:
description: "The reason for the mint or burn action"
- name: EVENT_ID
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_MINT_BURN_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_outbound_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -53,7 +53,9 @@ SELECT
memo,
in_tx,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -34,6 +34,10 @@ models:
description: "{{ doc('memo') }}"
- name: IN_TX
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_OUTBOUND_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pending_liquidity_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -55,7 +55,9 @@ SELECT
rune_e8,
pending_type,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -36,6 +36,10 @@ models:
description: "The amount of rune for the liquidity events"
- name: PENDING_TYPE
description: "The type of liquidity, can be 'add' or 'withdraw'"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_PENDING_LIQUIDITY_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_balance_change_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -57,7 +57,9 @@ SELECT
asset_add,
reason,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -29,7 +29,11 @@ models:
- name: ASSET_ADD
description: "False or True, if True, then the event is to add asset not rune"
- name: REASON
description: "The reason for the pool balance change"
description: "The reason for the pool balance change"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_BALANCE_CHANGE_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_block_balances_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -51,7 +51,9 @@ SELECT
synth_amount,
synth_amount_usd,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -42,6 +42,10 @@ models:
- not_null
- name: SYNTH_AMOUNT_USD
description: "The synth amount balance in USD for this pool name"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_BLOCK_BALANCES_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_block_fees_id',
incremental_strategy = 'merge',
cluster_by = ['day']
@ -45,6 +45,8 @@ SELECT
rune_liquidity_fees,
earnings,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -24,6 +24,10 @@ models:
description: "The liquidity fees paid in RUNE"
- name: EARNINGS
description: "The total earnings for this pool at this time"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_BLOCK_FEES_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_block_statistics_id',
incremental_strategy = 'merge',
cluster_by = ['day']
@ -103,6 +103,8 @@ SELECT
pool_units,
liquidity_unit_value_index,
prev_liquidity_unit_value_index,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -80,6 +80,10 @@ models:
description: ""
- name: PREV_LIQUIDITY_UNIT_VALUE_INDEX
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_BLOCK_STATISTICS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_pool_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -49,7 +49,9 @@ SELECT
asset,
status,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -22,6 +22,10 @@ models:
description: "The asset/pool name"
- name: STATUS
description: "The current status for this pool"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_refund_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -59,7 +59,9 @@ SELECT
code,
reason,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -40,6 +40,10 @@ models:
description: ""
- name: REASON
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_REFUND_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_reserve_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -55,7 +55,9 @@ SELECT
address,
e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -36,6 +36,10 @@ models:
description: "The address reserve the amount to the pool"
- name: E8
description: "The rune amount"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_RESERVE_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_rewards_event_entries_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -43,7 +43,9 @@ SELECT
rune_e8,
saver_e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -24,6 +24,10 @@ models:
description: "The rune amount of the rewards for this pool at this block"
- name: SAVER_E8
description: "The savers amount for this pool at this block"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_REWARDS_EVENT_ENTRIES_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_rewards_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -39,7 +39,9 @@ SELECT
) AS dim_block_id,
bond_e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -20,6 +20,10 @@ models:
where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS')
- name: BOND_E8
description: "The rune amount of the bond for this pool at this block"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_REWARDS_EVENTS_ID

View File

@ -57,7 +57,9 @@ SELECT
rune_e8,
_ASSET_IN_RUNE_E8,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -48,6 +48,10 @@ models:
description: ""
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_STAKE_EVENTS_ID

View File

@ -64,7 +64,9 @@ SELECT
failed_swaps_reasons,
event_id,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -46,6 +46,10 @@ models:
description: "the reason of failed swaps"
- name: event_id
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_STREAMLING_SWAP_DETAILS_EVENTS_ID

View File

@ -88,7 +88,9 @@ SELECT
streaming_count,
streaming_quantity,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -67,7 +67,11 @@ models:
- name: STREAMING_COUNT
description: "The count of the streaming events"
- name: STREAMING_QUANTITY
description: "The quantity of the streaming events"
description: "The quantity of the streaming events"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_SWAPS_ID

View File

@ -70,7 +70,9 @@ SELECT
_DIRECTION,
event_id,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -81,7 +81,11 @@ models:
- name: STREAMING_COUNT
description: "The count of the streaming events"
- name: STREAMING_QUANTITY
description: "The quantity of the streaming events"
description: "The quantity of the streaming events"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_SWAP_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_switch_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -49,7 +49,9 @@ SELECT
burn_e8,
mint_e8,
A._INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -30,6 +30,10 @@ models:
description: ""
- name: MINT_E8
description: ""
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_SWITCH_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_total_block_rewards_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -43,7 +43,9 @@ SELECT
rune_amount,
rune_amount_usd,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -28,6 +28,10 @@ models:
- not_null
- name: RUNE_AMOUNT_USD
description: "The rewards measured in RUNE amount in the USD"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_TOTAL_BLOCK_REWARDS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_total_value_locked_id',
incremental_strategy = 'merge'
) }}
@ -37,6 +37,8 @@ SELECT
total_value_bonded,
total_value_locked,
_INSERTED_TIMESTAMP,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A

View File

@ -19,6 +19,10 @@ models:
description: "The total amount of rune provided by the node operators and bonded in the pool"
- name: TOTAL_VALUE_LOCKED
description: "The total rune value locked in the pool"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_TOTAL_VALUE_LOCKED_ID

View File

@ -68,7 +68,9 @@ SELECT
A.imp_loss_protection_e8,
A._emit_asset_in_rune_e8,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -76,6 +76,10 @@ models:
description: ""
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_UNSTAKE_EVENTS_ID

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }}},
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} },
unique_key = 'fact_update_node_account_status_events_id',
incremental_strategy = 'merge',
cluster_by = ['block_timestamp::DATE']
@ -42,7 +42,9 @@ SELECT
current_status,
node_address,
A._inserted_timestamp,
'{{ env_var("DBT_CLOUD_RUN_ID", "manual") }}' AS _audit_run_id
'{{ invocation_id }}' AS _audit_run_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
base A
LEFT JOIN {{ ref('core__dim_block') }}

View File

@ -30,6 +30,10 @@ models:
description: "Address of node operator"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_UPDATE_NODE_ACCOUNT_STATUS_EVENTS_ID

Some files were not shown because too many files have changed in this diff Show More