mirror of
https://github.com/FlipsideCrypto/cosmos-models.git
synced 2026-02-06 13:26:44 +00:00
parent
7734e434cd
commit
a2e7ebaadc
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 --exclude models/bronze_api/bronze_api__get_validator_metadata.sql models/silver/_observability/silver_observability*
|
||||
dbt run --exclude models/silver/_observability/silver_observability*
|
||||
environment: workflow_prod
|
||||
warehouse: ${{ vars.WAREHOUSE }}
|
||||
secrets: inherit
|
||||
4
.github/workflows/dbt_run_udf_blockchain.yml
vendored
4
.github/workflows/dbt_run_udf_blockchain.yml
vendored
@ -28,9 +28,9 @@ jobs:
|
||||
with:
|
||||
dbt_command: |
|
||||
dbt run-operation get_blockchain_api
|
||||
dbt run -m models/silver/silver__blockchain.sql
|
||||
dbt run -m models/silver/core/silver__blockchain.sql
|
||||
dbt run-operation get_blockchain_api
|
||||
dbt run -m models/silver/silver__blockchain.sql
|
||||
dbt run -m models/silver/core/silver__blockchain.sql
|
||||
environment: workflow_prod
|
||||
warehouse: ${{ vars.WAREHOUSE }}
|
||||
secrets: inherit
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config(
|
||||
materialized = 'table',
|
||||
post_hook = "call silver.sp_bulk_get_asset_metadata()"
|
||||
post_hook = "call silver.sp_bulk_get_asset_metadata()",
|
||||
enabled = False
|
||||
) }}
|
||||
|
||||
WITH call AS (
|
||||
@ -18,12 +18,13 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
**Click on the links below to jump to the documentation for each schema.**
|
||||
|
||||
### Core Tables (`Cosmos`.`CORE`.`<table_name>`)
|
||||
### Governance Tables (`Cosmos`.`GOV`.`<table_name>`)
|
||||
|
||||
**Dimension Tables:**
|
||||
**Core Dimension Tables:**
|
||||
- [dim_labels](#!/model/model.cosmos_models.core__dim_labels)
|
||||
- [dim_tokens](#!/model/model.cosmos_models.core__dim_tokens)
|
||||
|
||||
**Fact Tables:**
|
||||
**Core Fact Tables:**
|
||||
- [fact_blocks](#!/model/model.cosmos.core__fact_blocks)
|
||||
- [fact_governance_proposal_deposits](#!/model/model.cosmos.core__fact_governance_proposal_deposits)
|
||||
- [fact_governance_submit_proposal](#!/model/model.cosmos.core__fact_governance_submit_proposal)
|
||||
@ -34,6 +35,17 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [fact_transfers](#!/model/model.cosmos.core__fact_transfers)
|
||||
- [fact_validators](#!/model/model.cosmos.core__fact_validators)
|
||||
|
||||
**Governance Dimension Tables:**
|
||||
- [dim_vote_options](#!/model/model.cosmos_models.gov__dim_vote_options)
|
||||
|
||||
|
||||
**Governance Fact Tables:**
|
||||
- [fact_governance_proposal_deposits](#!/model/model.cosmos.gov__fact_governance_proposal_deposits)
|
||||
- [fact_governance_submit_proposal](#!/model/model.cosmos.gov__fact_governance_submit_proposal)
|
||||
- [fact_governance_votes](#!/model/model.cosmos.gov__fact_governance_votes)
|
||||
- [fact_msg_attributes](#!/model/model.cosmos.core__fact_msg_attributes)
|
||||
- [fact_validators](#!/model/model.cosmos.gov__fact_validators)
|
||||
|
||||
|
||||
## **Data Model Overview**
|
||||
|
||||
@ -41,7 +53,7 @@ The Cosmos models are built a few different ways, but the core fact tables are b
|
||||
|
||||
- Bronze: Data is loaded in from the source as a view
|
||||
- Silver: All necessary parsing, filtering, de-duping, and other transformations are done here
|
||||
- Gold (or core): Final views and tables that are available publicly
|
||||
- Gold (core/gov): Final views and tables that are available publicly
|
||||
|
||||
The dimension tables are sourced from a variety of on-chain and off-chain sources.
|
||||
|
||||
@ -69,7 +81,7 @@ Note that you can also right-click on models to interactively filter and explore
|
||||
|
||||
### **More information**
|
||||
- [Flipside](https://flipsidecrypto.xyz/)
|
||||
- [Velocity](https://app.flipsidecrypto.com/velocity?nav=Discover)
|
||||
- [Data Studio](https://flipsidecrypto.xyz/edit)
|
||||
- [Tutorials](https://docs.flipsidecrypto.com/our-data/tutorials)
|
||||
- [Github](https://github.com/FlipsideCrypto/cosmos-models)
|
||||
- [What is dbt?](https://docs.getdbt.com/docs/introduction)
|
||||
|
||||
9
models/gold/core/core__dim_vote_options.sql
Normal file
9
models/gold/core/core__dim_vote_options.sql
Normal file
@ -0,0 +1,9 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }} }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gov__dim_vote_options') }}
|
||||
13
models/gold/core/core__dim_vote_options.yml
Normal file
13
models/gold/core/core__dim_vote_options.yml
Normal file
@ -0,0 +1,13 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_vote_options
|
||||
description: "Deprecating soon: This is a notice that we're replacing this table with gov.dim_vote_options. Please migrate queries to the new table by 9/11/23. There will be no column changes or any other changes of any kind."
|
||||
columns:
|
||||
- name: VOTE_OPTION
|
||||
description: "{{ doc('vote_option') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DESCRIPTION
|
||||
description: This describes the vote option the user selected
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
@ -0,0 +1,9 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gov__fact_governance_proposal_deposits') }}
|
||||
41
models/gold/core/core__fact_governance_proposal_deposits.yml
Normal file
41
models/gold/core/core__fact_governance_proposal_deposits.yml
Normal file
@ -0,0 +1,41 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_proposal_deposits
|
||||
description: "Deprecating soon: This is a notice that we're replacing this table with gov.fact_governance_proposal_deposits. Please migrate queries to the new table by 9/11/23. There will be no column changes or any other changes of any kind."
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DEPOSITOR
|
||||
description: "{{ doc('depositor') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DECIMAL
|
||||
description: "{{ doc('decimal') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
@ -0,0 +1,9 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gov__fact_governance_submit_proposal') }}
|
||||
33
models/gold/core/core__fact_governance_submit_proposal.yml
Normal file
33
models/gold/core/core__fact_governance_submit_proposal.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_submit_proposal
|
||||
description: "Deprecating soon: This is a notice that we're replacing this table with gov.fact_governance_submit_proposal. Please migrate queries to the new table by 9/11/23. There will be no column changes or any other changes of any kind."
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSER
|
||||
description: "{{ doc('proposer') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSAL_TYPE
|
||||
description: "{{ doc('proposal_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
9
models/gold/core/core__fact_governance_votes.sql
Normal file
9
models/gold/core/core__fact_governance_votes.sql
Normal file
@ -0,0 +1,9 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gov__fact_governance_votes') }}
|
||||
33
models/gold/core/core__fact_governance_votes.yml
Normal file
33
models/gold/core/core__fact_governance_votes.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_votes
|
||||
description: "Deprecating soon: This is a notice that we're replacing this table with gov.fact_governance_votes. Please migrate queries to the new table by 9/11/23. There will be no column changes or any other changes of any kind."
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: VOTER
|
||||
description: "{{ doc('voter') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: VOTE_OPTION
|
||||
description: "{{ doc('vote_option') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
8
models/gold/core/core__fact_validators.sql
Normal file
8
models/gold/core/core__fact_validators.sql
Normal file
@ -0,0 +1,8 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gov__fact_validators') }}
|
||||
89
models/gold/core/core__fact_validators.yml
Normal file
89
models/gold/core/core__fact_validators.yml
Normal file
@ -0,0 +1,89 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_validators
|
||||
description: "Deprecating soon: This is a notice that we're replacing this table with gov.fact_validators. Please migrate queries to the new table by 9/11/23. There will be no column changes or any other changes of any kind."
|
||||
columns:
|
||||
- name: ADDRESS
|
||||
description: "{{ doc('address') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CREATOR
|
||||
description: "{{ doc('creator') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_TYPE
|
||||
description: "{{ doc('label_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_SUBTYPE
|
||||
description: "{{ doc('label_subtype') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL
|
||||
description: "{{ doc('label') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROJECT_NAME
|
||||
description: "{{ doc('project_name') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: ACCOUNT_ADDRESS
|
||||
description: The Cosmos address of the user / entity that operates the validator.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DELEGATOR_SHARES
|
||||
description: The number of tokens staked to the validator.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: SELF_DELEGATION
|
||||
description: The number of ATOM tokens that the operator currently has staked with their own validator.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: NUM_DELEGATORS
|
||||
description: The number of wallets that stake their ATOM tokens with the validator.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RATE
|
||||
description: The commission rate that the validator is currently charging.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MAX_CHANGE_RATE
|
||||
description: The maximum rate at which a validator can change their commission per day.
|
||||
tests:
|
||||
- not_null
|
||||
- name: MAX_RATE
|
||||
description: The maximum commission rate that the validator can charge
|
||||
tests:
|
||||
- not_null
|
||||
- name: COMMISSION_RATE_LAST_UPDATED
|
||||
description: The date of the last commission change.
|
||||
tests:
|
||||
- not_null
|
||||
- name: STATUS
|
||||
description: Validators with a status of BOND_STATUS_BONDED are active and validators with a status of BOND_STATUS_UNBONDED are inactive.
|
||||
tests:
|
||||
- not_null
|
||||
- name: JAILED
|
||||
description: FALSE when a validator is not jailed, TRUE when a validator is jailed
|
||||
tests:
|
||||
- not_null
|
||||
- name: RANK
|
||||
description: The rank of the validator in the validator set. Rank is determined by the number of ATOM tokens staked to the validator
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: NUM_GOVERNANCE_VOTES
|
||||
description: The number of governance proposals the validator has voted on during its lifetime.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RAW_METADATA
|
||||
description: "{{ doc('raw_metadata') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: UNIQUE_KEY
|
||||
description: The unique key of the table
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
@ -1,20 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta={
|
||||
'database_tags':{
|
||||
'table': {
|
||||
'PURPOSE': 'GOVERNANCE'
|
||||
}
|
||||
}
|
||||
}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
proposer,
|
||||
proposal_id,
|
||||
proposal_type
|
||||
FROM {{ ref('silver__governance_submit_proposal') }}
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_vote_options
|
||||
- name: gov__dim_vote_options
|
||||
description: Dimensional table with the vote options on Cosmos and what they correspond to.
|
||||
columns:
|
||||
- name: VOTE_OPTION
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_proposal_deposits
|
||||
description: Records of all proposal deposits that have occurred on Cosmos, dating back to the genesis block. At least 250 ATOM must be deposited for a proposal to be voted on. The columns blockchain, chain_id, and tx_status will be deprecating soon.
|
||||
- name: gov__fact_governance_proposal_deposits
|
||||
description: Records of all proposal deposits that have occurred on Cosmos, dating back to the genesis block. At least 250 ATOM must be deposited for a proposal to be voted on.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
15
models/gold/gov/gov__fact_governance_submit_proposal.sql
Normal file
15
models/gold/gov/gov__fact_governance_submit_proposal.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'GOVERNANCE' }}}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
proposer,
|
||||
proposal_id,
|
||||
proposal_type
|
||||
FROM
|
||||
{{ ref('silver__governance_submit_proposal') }}
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_submit_proposal
|
||||
- name: gov__fact_governance_submit_proposal
|
||||
description: Records of all proposal submissions on Cosmos, dating back to the genesis block.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_governance_votes
|
||||
- name: gov__fact_governance_votes
|
||||
description: Records of all votes on proposals.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_validators
|
||||
- name: gov__fact_validators
|
||||
description: A table that contains labels for and additional information about Cosmos Hub validators
|
||||
columns:
|
||||
- name: ADDRESS
|
||||
Loading…
Reference in New Issue
Block a user