mirror of
https://github.com/FlipsideCrypto/sei-models.git
synced 2026-02-06 18:26:44 +00:00
check in
This commit is contained in:
parent
fe01865451
commit
24797adc6f
2
.github/workflows/dbt_run_daily.yml
vendored
2
.github/workflows/dbt_run_daily.yml
vendored
@ -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
|
||||
|
||||
5
models/descriptions/_inserted_timestamp.md
Normal file
5
models/descriptions/_inserted_timestamp.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs _inserted_timestamp %}
|
||||
|
||||
The time the block was inserted into to the Flipside database.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
5
models/descriptions/modified_timestamp.md
Normal file
5
models/descriptions/modified_timestamp.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs modified_timestamp %}
|
||||
|
||||
The utc timestamp at which the row was last modified.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/pk.md
Normal file
5
models/descriptions/pk.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs pk %}
|
||||
|
||||
The unique identifier for each row in the table.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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') }}
|
||||
|
||||
@ -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") }}'
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -60,6 +60,6 @@ models:
|
||||
tests:
|
||||
- not_null
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
description: "{{ doc('_inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user