This commit is contained in:
Eric Laurello 2023-12-04 14:47:10 -05:00
parent fe01865451
commit 24797adc6f
58 changed files with 552 additions and 92 deletions

View File

@ -28,7 +28,7 @@ jobs:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_run_template.yml@main
with:
dbt_command: |
dbt run -m "sei_model,tag:daily"
dbt run -m "sei_models,tag:daily"
environment: workflow_prod
warehouse: ${{ vars.WAREHOUSE }}
secrets: inherit

View File

@ -0,0 +1,5 @@
{% docs _inserted_timestamp %}
The time the block was inserted into to the Flipside database.
{% enddocs %}

View File

@ -1,5 +1,5 @@
{% docs inserted_timestamp %}
The time the block was inserted into to the Flipside database.
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

@ -10,6 +10,20 @@ SELECT
label_type,
label_subtype,
project_name AS label,
address_name AS address_name
address_name AS address_name,
COALESCE (
crosschain_labels_id,
{{ dbt_utils.generate_surrogate_key(
['address']
) }}
) AS dim_labels_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__croschain_labels') }}

View File

@ -30,4 +30,10 @@ models:
- name: LABEL
description: "{{ doc('label') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: DIM_LABELS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -7,6 +7,20 @@ SELECT
currency,
decimals,
token_name,
symbol
symbol,
COALESCE (
asset_metadata_id,
{{ dbt_utils.generate_surrogate_key(
['currency']
) }}
) AS dim_tokens_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__asset_metadata') }}

View File

@ -10,4 +10,10 @@ models:
- name: TOKEN_NAME
description: The description of the token
- name: SYMBOL
description: The common symbol of the token
description: The common symbol of the token
- name: DIM_TOKENS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -10,6 +10,20 @@ SELECT
tx_count,
proposer_address,
validator_hash,
header
header,
COALESCE (
blocks_id,
{{ dbt_utils.generate_surrogate_key(
['block_id']
) }}
) AS fact_blocks_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__blocks') }}

View File

@ -30,4 +30,10 @@ models:
- name: HEADER
description: "{{ doc('header') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_BLOCKS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -17,6 +17,20 @@ SELECT
msg_type,
attribute_index,
attribute_key,
attribute_value
attribute_value,
COALESCE (
msg_attributes_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index','attribute_index']
) }}
) AS fact_msg_attributes_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__msg_attributes') }}

View File

@ -39,4 +39,9 @@ models:
description: "They value from the key-value pair from the message attribute"
tests:
- dbt_expectations.expect_column_to_exist
- name: FACT_MSG_ATTRIBUTES_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -15,6 +15,20 @@ SELECT
) AS msg_group,
msg_index,
msg_type,
msg
msg,
COALESCE (
msgs_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_msgs_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__msgs') }}

View File

@ -35,4 +35,9 @@ models:
description: "A block of json that contains the message attributes in base64 encoding."
tests:
- dbt_expectations.expect_column_to_exist
- name: FACT_MSGS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -14,6 +14,20 @@ SELECT
A.tx_sender,
A.voter,
A.amount,
A.currency
A.currency,
COALESCE (
oracle_votes_id,
{{ dbt_utils.generate_surrogate_key(
['_unique_key']
) }}
) AS fact_oracle_votes_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__oracle_votes') }} A

View File

@ -32,4 +32,10 @@ models:
- name: CURRENCY
description: "{{ doc('currency') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_ORACLE_VOTES_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -14,6 +14,20 @@ SELECT
gas_used,
gas_wanted,
tx_code,
msgs
msgs,
COALESCE (
transactions_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id']
) }}
) AS fact_transactions_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__transactions_final') }}

View File

@ -52,3 +52,9 @@ models:
description: "The underlying json from the messages or events within the transactions"
tests:
- dbt_expectations.expect_column_to_exist
- name: FACT_TRANSACTIONS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -12,7 +12,21 @@ SELECT
sender,
amount,
currency,
receiver
receiver,
COALESCE (
transfers_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_transfers_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__transfers') }}
UNION ALL
@ -25,6 +39,20 @@ SELECT
sender,
amount,
currency,
receiver
receiver,
COALESCE (
transfers_ibc_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_transfers_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__transfers_ibc') }}

View File

@ -38,4 +38,10 @@ models:
- name: RECEIVER
description: "{{ doc('receiver') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_TRANSFERS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -4,39 +4,104 @@
tags = ['noncore']
) }}
{% set models = [
('astroport', ref('silver__dex_swaps_astroport')),
('fuzio', ref('silver__dex_swaps_fuzio')),
('seaswap', ref('silver__dex_swaps_seaswap')) ] %}
SELECT
*
'astroport' AS platform,
block_id,
block_timestamp,
tx_succeeded,
tx_id,
swapper,
msg_group,
msg_sub_group,
msg_index,
amount_in,
currency_in,
amount_out,
currency_out,
pool_address,
pool_name,
_inserted_timestamp,
COALESCE (
dex_swaps_astroport_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_dex_swaps_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
({% for models in models %}
SELECT
'{{ models[0] }}' AS platform,
block_id,
block_timestamp,
tx_succeeded,
tx_id,
swapper,
msg_group,
msg_sub_group,
msg_index,
amount_in,
currency_in,
amount_out,
currency_out,
pool_address,
pool_name,
_inserted_timestamp
FROM
{{ models [1] }}
{% if not loop.last %}
{% if is_incremental() %}
{% endif %}
UNION ALL
{% endif %}
{% endfor %}
)
{{ ref('silver__dex_swaps_astroport') }}
UNION ALL
SELECT
'fuzio' AS platform,
block_id,
block_timestamp,
tx_succeeded,
tx_id,
swapper,
msg_group,
msg_sub_group,
msg_index,
amount_in,
currency_in,
amount_out,
currency_out,
pool_address,
pool_name,
_inserted_timestamp,
COALESCE (
dex_swaps_fuzio_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_dex_swaps_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__dex_swaps_fuzio') }}
UNION ALL
SELECT
'seaswap' AS platform,
block_id,
block_timestamp,
tx_succeeded,
tx_id,
swapper,
msg_group,
msg_sub_group,
msg_index,
amount_in,
currency_in,
amount_out,
currency_out,
pool_address,
pool_name,
_inserted_timestamp,
COALESCE (
dex_swaps_seaswap_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_dex_swaps_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__dex_swaps_seaswap') }}

View File

@ -36,3 +36,9 @@ models:
description: "{{ doc('pool_address') }}"
- name: POOL_NAME
description: "{{ doc('pool_name') }}"
- name: FACT_DEX_SWAPS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -25,7 +25,21 @@ SELECT
A.token2_amount,
A.token2_currency,
lp_token_address,
A._inserted_timestamp
A._inserted_timestamp,
COALESCE (
lp_actions_astroport_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_lp_actions_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__lp_actions_astroport') }} A
UNION ALL
@ -47,7 +61,21 @@ SELECT
A.token2_amount,
A.token2_currency,
lp_token_address,
A._inserted_timestamp
A._inserted_timestamp,
COALESCE (
lp_actions_fuzio_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_lp_actions_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__lp_actions_fuzio') }} A
UNION ALL
@ -69,7 +97,21 @@ SELECT
A.token2_amount,
A.token2_currency,
lp_token_address,
A._inserted_timestamp
A._inserted_timestamp,
COALESCE (
lp_actions_seaswap_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_lp_actions_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__lp_actions_seaswap') }} A
UNION ALL
@ -98,7 +140,21 @@ SELECT
A.token2_amount,
A.token2_currency,
lp_token_address,
A._inserted_timestamp
A._inserted_timestamp,
COALESCE (
lp_actions_levanna_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id','msg_index']
) }}
) AS fact_lp_actions_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__lp_actions_levana') }} A
WHERE

View File

@ -42,4 +42,9 @@ models:
description: "{{ doc('lp_token_amount') }}"
- name: LP_TOKEN_ADDRESS
description: "{{ doc('lp_token_address') }}"
- name: FACT_LP_ACTIONS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -12,6 +12,20 @@ SELECT
depositor,
proposal_id,
amount,
currency
currency,
COALESCE (
governance_proposal_deposits_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id']
) }}
) AS fact_governance_proposal_deposits_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__governance_proposal_deposits') }}

View File

@ -35,4 +35,9 @@ models:
description: "{{ doc('currency') }}"
tests:
- dbt_expectations.expect_column_to_exist
- name: FACT_GOVERNANCE_PROPOSAL_DEPOSITS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -13,6 +13,20 @@ SELECT
proposal_id,
proposal_type,
proposal_title,
proposal_description
proposal_description,
COALESCE (
governance_submit_proposal_id,
{{ dbt_utils.generate_surrogate_key(
['tx_id']
) }}
) AS fact_governance_submit_proposal_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__governance_submit_proposal') }}

View File

@ -38,4 +38,10 @@ models:
- name: PROPOSAL_DESCRIPTION
description: "{{ doc('proposal_description') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_GOVERNANCE_SUBMIT_PROPOSAL_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -13,6 +13,20 @@ SELECT
proposal_id,
vote_option,
vote_weight,
memo
memo,
COALESCE (
governance_votes_id,
{{ dbt_utils.generate_surrogate_key(
['_unique_id']
) }}
) AS fact_governance_votes_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__governance_votes') }}

View File

@ -34,4 +34,10 @@ models:
- name: MEMO
description: "{{ doc('memo') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_GOVERNANCE_VOTES_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -16,6 +16,20 @@ SELECT
redelegate_source_validator_address,
amount,
currency,
completion_time
completion_time,
COALESCE (
staking_id,
{{ dbt_utils.generate_surrogate_key(
['_unique_id']
) }}
) AS fact_staking_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__staking') }}

View File

@ -47,3 +47,9 @@ models:
description: "{{ doc('redelegate_source_validator_address') }}"
- name: COMPLETION_TIME
description: "{{ doc('completion_time') }}"
- name: FACT_STAKING_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -15,6 +15,20 @@ SELECT
rewards_recipient,
validator_address,
amount,
currency
currency,
COALESCE (
staking_rewards_id,
{{ dbt_utils.generate_surrogate_key(
['_unique_id']
) }}
) AS fact_staking_rewards_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__staking_rewards') }}

View File

@ -46,4 +46,10 @@ models:
- name: VALIDATOR_ADDRESS
description: "{{ doc('validator_address') }}"
tests:
- dbt_expectations.expect_column_to_exist
- dbt_expectations.expect_column_to_exist
- name: FACT_STAKING_REWARDS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'

View File

@ -176,7 +176,7 @@ SELECT
DATE ASC rows unbounded preceding
) AS balance,
{{ dbt_utils.generate_surrogate_key(
['address','currency','balance_type']
['address','currency','date']
) }} AS daily_balances_staked_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,

View File

@ -63,7 +63,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -72,7 +72,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -69,7 +69,7 @@ models:
- name: MSG
description: "The underlying json from the message or event within the transactions"
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -60,6 +60,6 @@ models:
tests:
- not_null
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null

View File

@ -67,7 +67,7 @@ SELECT
tx_log :: STRING AS tx_log,
tx AS full_tx,
{{ dbt_utils.generate_surrogate_key(
['t.tx_id']
['tx_id']
) }} AS transactions_final_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,

View File

@ -82,7 +82,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -82,7 +82,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -69,7 +69,7 @@ models:
tests:
- not_null
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -21,7 +21,6 @@ SELECT
) }} AS crosschain_labels_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
_inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
{{ source(

View File

@ -113,7 +113,13 @@ SELECT
p.proposal_id :: NUMBER AS proposal_id,
v.amount :: FLOAT AS amount,
v.currency,
_inserted_timestamp
{{ dbt_utils.generate_surrogate_key(
['tx_id']
) }} AS governance_proposal_deposits_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
_inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
deposit_value v
INNER JOIN proposal_ids p

View File

@ -71,7 +71,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -114,7 +114,13 @@ COALESCE(
tx_body :messages [0] :msgs [0] :content :description
) :: STRING AS proposal_description,
#}
_inserted_timestamp
{{ dbt_utils.generate_surrogate_key(
['tx_id']
) }} AS governance_submit_proposal_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
_inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
proposal_ids p
INNER JOIN proposal_type y

View File

@ -79,7 +79,7 @@ models:
- STRING
- VARCHAR
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -125,13 +125,19 @@ SELECT
vote_option,
vote_weight,
NULL AS memo,
_inserted_timestamp,
concat_ws(
'-',
tx_id,
msg_group,
msg_sub_group,
voter
) AS _unique_key
) AS _unique_key,
{{ dbt_utils.generate_surrogate_key(
['_unique_key']
) }} AS governance_votes_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
_inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
agg

View File

@ -60,7 +60,7 @@ models:
tests:
- not_null
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- name: VOTE_WEIGHT

View File

@ -354,7 +354,6 @@ SELECT
A.validator_address,
A.redelegate_source_validator_address,
A.completion_time,
A._inserted_timestamp,
concat_ws(
'-',
tx_id,
@ -367,6 +366,13 @@ SELECT
currency,
delegator_address,
validator_address
) AS _unique_key
) AS _unique_key,
{{ dbt_utils.generate_surrogate_key(
['_unique_key']
) }} AS staking_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
A._inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
add_dec A

View File

@ -129,7 +129,7 @@ models:
column_type_list:
- TIMESTAMP_NTZ
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -213,7 +213,6 @@ SELECT
A.currency,
A.validator_address,
'withdraw_rewards' AS action,
A._inserted_timestamp,
concat_ws(
'-',
A.tx_id,
@ -222,6 +221,14 @@ SELECT
A.currency,
A.delegator_address,
A.validator_address
) AS _unique_key
) AS _unique_key,
{{ dbt_utils.generate_surrogate_key(
['_unique_key']
) }} AS staking_rewards_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
A._inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
FROM
prefinal A

View File

@ -98,7 +98,7 @@ models:
- dbt_expectations.expect_column_values_to_match_regex:
regex: seivaloper1[0-9a-z]{38,38}
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -183,7 +183,13 @@ SELECT
RIGHT(am.value, LENGTH(am.value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(am.value, '[^[:digit:]]', ' ')), ' ', 0))) AS currency,
A.validator_address_operator,
d.validator_address_reward,
b._inserted_timestamp
{{ dbt_utils.generate_surrogate_key(
['a.tx_id','a.msg_group','a.msg_sub_group']
) }} AS validator_commission_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
b._inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
combo A
JOIN LATERAL SPLIT_TO_TABLE(

View File

@ -96,7 +96,7 @@ models:
- dbt_expectations.expect_column_values_to_match_regex:
regex: sei[0-9a-z]{39,39}
- name: _INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -16,7 +16,13 @@ SELECT
b.value :slugs AS slugs,
b.value :symbol :: STRING AS symbol,
b.value :type :: STRING AS TYPE,
_inserted_timestamp
{{ dbt_utils.generate_surrogate_key(
['contract_address']
) }} AS prices_api_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
_inserted_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
{{ ref(
'bronze_api__get_prices_api'