From 89817b0c715f267e743df1015471c9fe843391c4 Mon Sep 17 00:00:00 2001 From: Jessica Huhnke <91915469+jhuhnke@users.noreply.github.com> Date: Thu, 28 Apr 2022 13:32:39 -0500 Subject: [PATCH] An 1079 osmosis labels (#7) * silver labels models - first pass * added descriptions * removed description column in table and re-referenced descriptions in .ymls * changed config to table set up * remove comment Co-authored-by: Desmond Hui --- models/descriptions/address.md | 5 ++ models/descriptions/blockchain.md | 5 ++ models/descriptions/creator.md | 5 ++ models/descriptions/label.md | 5 ++ models/descriptions/label_subtype.md | 5 ++ models/descriptions/label_type.md | 5 ++ models/descriptions/project_name.md | 5 ++ models/descriptions/value.md | 5 ++ models/silver/silver__asset_metadata.sql | 17 +++++++ models/silver/silver__asset_metadata.yml | 46 ++++++++++++++++++ models/silver/silver__validator_metadata.sql | 19 ++++++++ models/silver/silver__validator_metadata.yml | 50 ++++++++++++++++++++ models/sources.yml | 2 +- 13 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 models/descriptions/address.md create mode 100644 models/descriptions/blockchain.md create mode 100644 models/descriptions/creator.md create mode 100644 models/descriptions/label.md create mode 100644 models/descriptions/label_subtype.md create mode 100644 models/descriptions/label_type.md create mode 100644 models/descriptions/project_name.md create mode 100644 models/descriptions/value.md create mode 100644 models/silver/silver__asset_metadata.sql create mode 100644 models/silver/silver__asset_metadata.yml create mode 100644 models/silver/silver__validator_metadata.sql create mode 100644 models/silver/silver__validator_metadata.yml diff --git a/models/descriptions/address.md b/models/descriptions/address.md new file mode 100644 index 0000000..36215fe --- /dev/null +++ b/models/descriptions/address.md @@ -0,0 +1,5 @@ +{% docs address %} + +Address unique to an individual wallet, validator, or token. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/blockchain.md b/models/descriptions/blockchain.md new file mode 100644 index 0000000..e86be00 --- /dev/null +++ b/models/descriptions/blockchain.md @@ -0,0 +1,5 @@ +{% docs blockchain %} + +In this table, always Osmosis. Used to join to cross-chain tables. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/creator.md b/models/descriptions/creator.md new file mode 100644 index 0000000..ff72c36 --- /dev/null +++ b/models/descriptions/creator.md @@ -0,0 +1,5 @@ +{% docs creator %} + +Name of the label creator - for now, this will always be "Flipside." + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/label.md b/models/descriptions/label.md new file mode 100644 index 0000000..51af3dc --- /dev/null +++ b/models/descriptions/label.md @@ -0,0 +1,5 @@ +{% docs label %} + +The label or name of the address. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/label_subtype.md b/models/descriptions/label_subtype.md new file mode 100644 index 0000000..113de57 --- /dev/null +++ b/models/descriptions/label_subtype.md @@ -0,0 +1,5 @@ +{% docs label_subtype %} + +Adds more detail to the label type. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/label_type.md b/models/descriptions/label_type.md new file mode 100644 index 0000000..c81472b --- /dev/null +++ b/models/descriptions/label_type.md @@ -0,0 +1,5 @@ +{% docs label_type %} + +A broad category that describes what a label is representing. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/project_name.md b/models/descriptions/project_name.md new file mode 100644 index 0000000..a8a553d --- /dev/null +++ b/models/descriptions/project_name.md @@ -0,0 +1,5 @@ +{% docs project_name %} + +The name of the project the label belongs to. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/value.md b/models/descriptions/value.md new file mode 100644 index 0000000..f676676 --- /dev/null +++ b/models/descriptions/value.md @@ -0,0 +1,5 @@ +{% docs value %} + +Additional details about the validator or token in json format. + +{% enddocs %} \ No newline at end of file diff --git a/models/silver/silver__asset_metadata.sql b/models/silver/silver__asset_metadata.sql new file mode 100644 index 0000000..71a33b0 --- /dev/null +++ b/models/silver/silver__asset_metadata.sql @@ -0,0 +1,17 @@ +{{ config( + materialized = 'table' +) }} + +SELECT + 'osmosis' AS blockchain, + base AS address, + 'flipside' AS creator, + 'token' AS label_type, + 'token_contract' AS label_subtype, + name AS label, + symbol AS project_name, + denom_units AS value +FROM {{ source( + 'osmosis_external', + 'asset_metadata_api' + ) }} \ No newline at end of file diff --git a/models/silver/silver__asset_metadata.yml b/models/silver/silver__asset_metadata.yml new file mode 100644 index 0000000..16dc3c3 --- /dev/null +++ b/models/silver/silver__asset_metadata.yml @@ -0,0 +1,46 @@ +version: 2 +models: + - name: silver__asset_metadata + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - BLOCKCHAIN + - CREATOR + - ADDRESS + columns: + - name: BLOCKCHAIN + description: "{{ doc('blockchain') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['osmosis'] + - name: ADDRESS + description: "{{ doc('address') }}" + tests: + - not_null + - name: CREATOR + description: "{{ doc('creator') }}" + tests: + - not_null + - name: LABEL_TYPE + description: "{{ doc('label_type') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['token'] + - name: LABEL_SUBTYPE + description: "{{ doc('label_subtype') }}" + tests: + - not_null + - name: LABEL + description: "{{ doc('label') }}" + tests: + - not_null + - name: PROJECT_NAME + description: "{{ doc('project_name') }}" + tests: + - not_null + - name: VALUE + description: "{{ doc('value') }}" + tests: + - not_null \ No newline at end of file diff --git a/models/silver/silver__validator_metadata.sql b/models/silver/silver__validator_metadata.sql new file mode 100644 index 0000000..f737e88 --- /dev/null +++ b/models/silver/silver__validator_metadata.sql @@ -0,0 +1,19 @@ +{{ config( + materialized = 'table' +) }} + +SELECT + operator_address AS address, + 'osmosis' AS blockchain, + 'flipside' AS creator, + 'operator' AS label_type, + 'validator' AS label_subtype, + moniker AS label, + identity AS project_name, + value +FROM + {{ source( + 'osmosis_external', + 'validator_metadata_api' + ) }} + \ No newline at end of file diff --git a/models/silver/silver__validator_metadata.yml b/models/silver/silver__validator_metadata.yml new file mode 100644 index 0000000..73ab7ec --- /dev/null +++ b/models/silver/silver__validator_metadata.yml @@ -0,0 +1,50 @@ +version: 2 +models: + - name: silver__validator_metadata + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - CREATOR + - ADDRESS + - BLOCKCHAIN + columns: + - name: ADDRESS + description: "{{ doc('address') }}" + tests: + - not_null + - name: BLOCKCHAIN + description: "{{ doc('blockchain') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['osmosis'] + - name: CREATOR + description: "{{ doc('creator') }}" + tests: + - not_null + - name: LABEL_TYPE + description: "{{ doc('label_type') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['operator'] + - name: LABEL_SUBTYPE + description: "{{ doc('label_subtype') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['validator'] + - name: LABEL + description: "{{ doc('label') }}" + tests: + - not_null + - name: PROJECT_NAME + description: "{{ doc('project_name') }}" + tests: + - not_null + tests: + - not_null + - name: VALUE + description: "{{ doc('value') }}" + tests: + - not_null \ No newline at end of file diff --git a/models/sources.yml b/models/sources.yml index 7257979..a3a2ee7 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -6,7 +6,7 @@ sources: schema: prod tables: - name: osmosis_blocks - - name: osmosis_txs + - name: osmosis_txs - name: osmosis_external schema: bronze loader: S3