diff --git a/models/bronze/bronze__labels.sql b/models/bronze/bronze__labels.sql new file mode 100644 index 0000000..def4be7 --- /dev/null +++ b/models/bronze/bronze__labels.sql @@ -0,0 +1,28 @@ +{{ config ( + materialized = 'view' +) }} + +WITH labels AS ( + + SELECT + system_created_at AS _system_created_at, + insert_date AS _ingested_at, + blockchain, + address, + creator, + label_type, + label_subtype, + address_name, + project_name + FROM + {{ source( + 'crosschain', + 'address_labels' + ) }} + WHERE + blockchain = 'flow' +) +SELECT + * +FROM + labels diff --git a/models/descriptions/address.md b/models/descriptions/address.md new file mode 100644 index 0000000..fef5a92 --- /dev/null +++ b/models/descriptions/address.md @@ -0,0 +1,5 @@ +{% docs address %} + +The on-chain address. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/address_name.md b/models/descriptions/address_name.md new file mode 100644 index 0000000..a6bc275 --- /dev/null +++ b/models/descriptions/address_name.md @@ -0,0 +1,5 @@ +{% docs address_name %} + +The name for a specific address, like Kraken or Huobi for CEX, or consensus vs verification for validator. + +{% 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..dc1b51c --- /dev/null +++ b/models/descriptions/blockchain.md @@ -0,0 +1,5 @@ +{% docs blockchain %} + +The name of the blockchain for this address. + +{% 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..a7247a6 --- /dev/null +++ b/models/descriptions/creator.md @@ -0,0 +1,5 @@ +{% docs creator %} + +The source of the labeling information for 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..c5ac13c --- /dev/null +++ b/models/descriptions/label_subtype.md @@ -0,0 +1,5 @@ +{% docs label_subtype %} + +The type of address, within the higher order label_type, such as hot wallet, deposit wallet, validator, etc. + +{% 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..d433a74 --- /dev/null +++ b/models/descriptions/label_type.md @@ -0,0 +1,5 @@ +{% docs label_type %} + +Predominant label categorization, such as CEX, Operator, NFT, etc. + +{% 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..27172cf --- /dev/null +++ b/models/descriptions/project_name.md @@ -0,0 +1,5 @@ +{% docs project_name %} + +The overarching project name, related to the address name. For example, Kraken (vs. Kraken Deposit Wallet for address_names). + +{% enddocs %} \ No newline at end of file diff --git a/models/silver/silver__labels.sql b/models/silver/silver__labels.sql new file mode 100644 index 0000000..e886c28 --- /dev/null +++ b/models/silver/silver__labels.sql @@ -0,0 +1,24 @@ +{{ config( + materialized = 'table', + cluster_by = ['address'], + unique_key = 'event_id', +) }} + +WITH labels AS ( + + SELECT + _ingested_at, + blockchain, + address, + creator, + label_type, + label_subtype, + address_name, + project_name + FROM + {{ ref('bronze__labels') }} +) +SELECT + * +FROM + labels diff --git a/models/silver/silver__labels.yml b/models/silver/silver__labels.yml new file mode 100644 index 0000000..0889ae4 --- /dev/null +++ b/models/silver/silver__labels.yml @@ -0,0 +1,73 @@ + +version: 2 + +models: + - name: silver__labels + description: |- + This table provides labels for addresses on the Flow blockchain. + + + columns: + - name: _ingested_at + description: "{{ doc('_ingested_at') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - TIMESTAMP_NTZ + + - name: blockchain + description: "{{ doc('blockchain') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: address + description: "{{ doc('address') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: creator + description: "{{ doc('creator') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: label_type + description: "{{ doc('label_type') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: label_subtype + description: "{{ doc('label_subtype') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: address_name + description: "{{ doc('address_name') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR + + - name: project_name + description: "{{ doc('project_name') }}" + tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - STRING + - VARCHAR diff --git a/models/sources.yml b/models/sources.yml index 0385c6c..4bfee5a 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -7,3 +7,9 @@ sources: tables: - name: flow_blocks - name: flow_txs + + - name: crosschain + database: flipside_prod_db + schema: crosschain + tables: + - name: address_labels \ No newline at end of file