mirror of
https://github.com/FlipsideCrypto/aptos-models.git
synced 2026-02-06 18:06:53 +00:00
Merge pull request #14 from FlipsideCrypto/an-4466/labels_update
change labels source and updates
This commit is contained in:
commit
d12bcb2a15
@ -38,6 +38,9 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
**Core Convenience Tables:**
|
||||
- [ez_native_transfers](#!/model/model.aptos_models.core__ez_native_transfers)
|
||||
|
||||
**Defi Fact Tables:**
|
||||
- [fact_bridge_activity](#!/model/model.aptos_models.defi__fact_bridge_activity)
|
||||
|
||||
|
||||
**Price Dimension Tables:**
|
||||
- [dim_asset_metadata](#!/model/model.aptos_models.price__dim_asset_metadata)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{% docs core__dim_labels %}
|
||||
|
||||
Contains token and validator labels for Aptos.
|
||||
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 %}
|
||||
|
||||
@ -10,6 +10,9 @@ SELECT
|
||||
label_type,
|
||||
label_subtype,
|
||||
project_name AS label,
|
||||
address_name AS address_name
|
||||
address_name AS address_name,
|
||||
labels_combined_id AS dim_labels_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__labels') }}
|
||||
|
||||
@ -30,4 +30,10 @@ models:
|
||||
- name: LABEL
|
||||
description: "{{ doc('label') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DIM_LABELS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
@ -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 = ['noncore']
|
||||
) }}
|
||||
|
||||
@ -13,32 +16,26 @@ 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,
|
||||
TO_TIMESTAMP_NTZ(insert_date) AS _inserted_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain',
|
||||
'dim_labels'
|
||||
'crosschain_silver',
|
||||
'labels_combined'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'aptos'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
modified_timestamp
|
||||
)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY address
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC) = 1)
|
||||
|
||||
@ -9,6 +9,5 @@ models:
|
||||
- name: ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ sources:
|
||||
- name: token_prices_all_providers_hourly
|
||||
- name: asset_metadata_priority
|
||||
- name: asset_metadata_all_providers
|
||||
- name: labels_combined
|
||||
- name: aptos_bronze
|
||||
database: aptos
|
||||
schema: bronze
|
||||
|
||||
Loading…
Reference in New Issue
Block a user