lables update (#49)

This commit is contained in:
eric-laurello 2024-01-30 14:14:50 -05:00 committed by GitHub
parent e7480187d1
commit 19d045cabb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 69 additions and 2 deletions

View File

@ -0,0 +1,5 @@
{% docs table_dim_labels %}
The labels table is a store of one-to-one address identifiers, or an address name. Labels are broken out into a "type" (such as cex, dex, dapp, games, etc.) and a "subtype" (ex: contract_deployer, hot_wallet, token_contract, etc.) in order to help classify each address name into similar groups. Our labels are sourced from many different places, but can primarily be grouped into two categories: automatic and manual. Automatic labels are continuously labeled based on certain criteria, such as a known contract deploying another contract, behavior based algorithms for finding deposit wallets, and consistent data pulls of custom protocol APIs. Manual labels are done periodically to find addresses that cannot be found programmatically such as finding new protocol addresses, centralized exchange hot wallets, or trending addresses. Labels can also be added by our community by using our add-a-label tool (https://science.flipsidecrypto.xyz/add-a-label/) or on-chain with near (https://near.social/lord1.near/widget/Form) and are reviewed by our labels team. A label can be removed by our labels team if it is found to be incorrect or no longer relevant; this generally will only happen for mislabeled deposit wallets.
{% enddocs %}

View File

@ -26,7 +26,7 @@ SELECT
) AS modified_timestamp
FROM
{{ ref('core__dim_tokens') }}
UNION
UNION ALL
SELECT
blockchain,
creator,
@ -51,3 +51,19 @@ SELECT
) AS modified_timestamp
FROM
{{ ref('gov__fact_validators') }}
UNION ALL
SELECT
blockchain,
creator,
address,
label_type,
label_subtype,
address_name AS label,
project_name,
labels_combined_id AS dim_labels_id,
inserted_timestamp,
modified_timestamp
FROM
{{ ref('silver__address_labels') }}
WHERE
label_subtype <> 'validator'

View File

@ -1,7 +1,11 @@
version: 2
models:
- name: core__dim_labels
description: Contains all Flipside sourced labels for the Cosmos blockchain.
description: '{{ doc("table_dim_labels") }}'
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ADDRESS
columns:
- name: ADDRESS
description: "{{ doc('address') }}"

View File

@ -0,0 +1,41 @@
{{ config(
materialized = 'incremental',
unique_key = ['address', 'blockchain'],
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = 'modified_timestamp::DATE',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address); DELETE FROM {{ this }} WHERE _is_deleted = TRUE;",
tags = ['daily']
) }}
SELECT
system_created_at,
insert_date,
blockchain,
address,
creator,
label_type,
label_subtype,
address_name,
project_name,
_is_deleted,
labels_combined_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
{{ source(
'crosschain_silver',
'labels_combined'
) }}
WHERE
blockchain = 'cosmos'
{% if is_incremental() %}
AND modified_timestamp >= (
SELECT
MAX(modified_timestamp)
FROM
{{ this }}
)
{% endif %}

View File

@ -35,6 +35,7 @@ sources:
schema: silver
tables:
- name: number_sequence
- name: labels_combined
- name: github_actions
database: cosmos
schema: github_actions