AN-6364 aptos shinam (#126)

This commit is contained in:
eric-laurello 2025-06-16 13:03:46 -04:00 committed by GitHub
parent 526f3a815b
commit 7f700d845e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 112 additions and 1 deletions

View File

@ -44,6 +44,7 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt run-operation run_sp_refresh_external_tables_aptos
dbt run -m external_models,tag:defillama external_models,tag:deepnftvalue external_models,tag:core external_models,tag:blast external_models,tag:polymarket external_models,tag:bitquery external_models,tag:oklink external_models,tag:artemis external_models,tag:aptos_gas --exclude models/defillama/bronze/bronze__defillama_stablecoin_supply.sql+
notify-failure:

View File

@ -0,0 +1,7 @@
{% macro run_sp_refresh_external_tables_aptos() %}
{% set sql %}
call bronze.sp_refresh_external_tables_aptos();
{% endset %}
{% do run_query(sql) %}
{% endmacro %}

View File

@ -0,0 +1,15 @@
{% macro sp_refresh_external_tables_aptos() %}
{% set sql %}
create or replace procedure bronze.sp_refresh_external_tables_aptos()
returns boolean
language sql
execute as caller
as
$$
begin
alter external table EXTERNAL.BRONZE.aptos_shinam refresh;
return TRUE;
end;
$${% endset %}
{% do run_query(sql) %}
{% endmacro %}

View File

@ -29,7 +29,7 @@ SELECT
b.value :count :: bigint AS metric_count,
b.value :amount :: FLOAT AS metric_amount,
b.value :amountInUSD :: FLOAT AS metric_amount_in_usd,
{{ dbt_utils.generate_surrogate_key([ 'metric', 'metric_date']) }} AS artemis_id,
{{ dbt_utils.generate_surrogate_key([ 'metric', 'metric_date']) }} AS lync_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id

View File

@ -0,0 +1,21 @@
{{ config (
materialized = "view",
tags = ['aptos_gas'],
) }}
SELECT
TO_DATE (
file_date :: STRING,
'YYYYMMDD'
) AS metric_date,
fund_name,
workspace_name,
contact_email,
fund_balance_remaining :: bigint AS fund_balance_remaining,
total_sponsorships :: bigint AS total_sponsorships,
total_fees :: bigint AS total_fees
FROM
{{ source(
'external_bronze',
'aptos_shinam'
) }}

View File

@ -0,0 +1,31 @@
{{ config (
materialized = "incremental",
incremental_strategy = 'delete+insert',
unique_key = ['metric_date'],
tags = ['aptos_gas'],
) }}
SELECT
metric_date,
fund_name,
workspace_name,
contact_email,
fund_balance_remaining,
total_sponsorships,
total_fees,
{{ dbt_utils.generate_surrogate_key([ 'metric_date', 'fund_name','workspace_name']) }} AS shinam_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
{{ ref('bronze_aptos__shinam_data') }}
{% if is_incremental() %}
WHERE
metric_date >= (
SELECT
MAX(metric_date)
FROM
{{ this }}
)
{% endif %}

View File

@ -0,0 +1,35 @@
version: 2
models:
- name: silver_aptos__shinam
description: "Shinam data"
columns:
- name: metric_date
description: "The date of the metric measurement"
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: fund_name
description: "Then the of the fund"
- name: workspace_name
description: "The name of the workspace"
- name: contact_email
description: "The contact email of the fund"
- name: fund_balance_remaining
description: "The fund balance remaining"
- name: total_sponsorships
description: "The total sponsorships"
- name: total_fees
description: "The total fees paid by the fund"

View File

@ -85,6 +85,7 @@ sources:
- name: farcaster_channel_follows
- name: farcaster_profile_with_addresses
- name: farcaster_warpcast_power_users
- name: aptos_shinam
- name: avalanche_share
database: ava_labs_share
schema: primary