is deleted labels (#198)

* is deleted labels

* spelling

* fix
This commit is contained in:
Austin 2024-01-30 12:38:59 -05:00 committed by GitHub
parent 9974a76af8
commit 6c09bbd79a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 24 deletions

View File

@ -11,11 +11,14 @@ SELECT
label_type,
label_subtype,
address_name,
project_name
project_name,
_is_deleted,
modified_timestamp,
labels_combined_id
FROM
{{ source(
'crosschain',
'dim_labels'
'crosschain_silver',
'labels_combined'
) }}
WHERE
blockchain = 'arbitrum'

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

@ -12,19 +12,8 @@ SELECT
label_type,
label_subtype,
project_name,
COALESCE (
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
labels_combined_id AS dim_labels_id,
inserted_timestamp,
modified_timestamp
FROM
{{ ref('silver__labels') }}

View File

@ -1,7 +1,7 @@
version: 2
models:
- name: core__dim_labels
description: '{{ doc("arb_labels_table") }}'
description: '{{ doc("table_dim_labels") }}'
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:

View File

@ -1,7 +1,10 @@
{{ config(
materialized = 'incremental',
unique_key = 'address',
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 = ['non_realtime']
) }}
@ -15,9 +18,8 @@ SELECT
label_subtype,
address_name,
project_name,
{{ dbt_utils.generate_surrogate_key(
['address']
) }} AS labels_id,
_is_deleted,
labels_combined_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
@ -27,10 +29,10 @@ WHERE
1 = 1
{% if is_incremental() %}
AND insert_date >= (
AND modified_timestamp >= (
SELECT
MAX(
insert_date
modified_timestamp
)
FROM
{{ this }}

View File

@ -39,6 +39,7 @@ sources:
- name: token_prices_all_providers_hourly
- name: asset_metadata_all_providers
- name: near_address_encoded
- name: labels_combined
- name: crosschain_public
database: crosschain
schema: bronze_public