Skip to content

Commit

Permalink
Converted Aptos data to incremental
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny77D committed Aug 15, 2024
1 parent 0c6e000 commit b7db3d0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion models/staging/aptos/fact_aptos_daa_txns_gas_gas_usd_revenue.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ config(materialized="table") }}
{{ config(materialized="incremental", unique_key='date') }}
with
apt_prices as ({{ get_coingecko_price_with_latest("aptos") }}),
single_signed_transactions as (
Expand All @@ -8,6 +8,9 @@ with
tx_type = 'user_transaction'
and success = 'true'
and parse_json(signature):public_key is not null
{% if is_incremental() %}
and block_timestamp::date > (select dateadd('day', -3, max(date)) from {{ this }})
{% endif %}
),
primary_multi_signed_transactions as (
select
Expand All @@ -18,6 +21,9 @@ with
tx_type = 'user_transaction'
and success = 'true'
and parse_json(signature):sender is not null
{% if is_incremental() %}
and block_timestamp::date > (select dateadd('day', -3, max(date)) from {{ this }})
{% endif %}
),
raw_secondary_multi_signed_transactions as (
select
Expand All @@ -28,6 +34,9 @@ with
tx_type = 'user_transaction'
and success = 'true'
and parse_json(signature):secondary_signers is not null
{% if is_incremental() %}
and block_timestamp::date > (select dateadd('day', -3, max(date)) from {{ this }})
{% endif %}
),
secondary_multi_signed_transactions as (
select block_timestamp::date as date, value:"public_key" as signer
Expand Down Expand Up @@ -69,6 +78,9 @@ with
sum(gas_used * gas_unit_price) / 1E8 as gas
from aptos_flipside.core.fact_transactions
where tx_type = 'user_transaction'
{% if is_incremental() %}
and block_timestamp::date > (select dateadd('day', -3, max(date)) from {{ this }})
{% endif %}
group by block_timestamp::date
),
raw as (
Expand Down

0 comments on commit b7db3d0

Please sign in to comment.