Skip to content

Commit

Permalink
AN-5528/Flow API Balances - chg evm_address source (#382)
Browse files Browse the repository at this point in the history
* chg evm_address source

* disable transaction_entries

* change batch
  • Loading branch information
forgxyz authored Nov 21, 2024
1 parent 8699abd commit 15dcc02
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ run-name: dbt_run_scheduled_transaction_entries_realtime

on:
workflow_dispatch:
schedule:
# schedule:
# Daily at 00:00 UTC
- cron: "0 0 * * *"
# - cron: "0 0 * * *"

env:
USE_VARS: "${{ vars.USE_VARS }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
target = "{{this.schema}}.{{this.identifier}}",
params = {
"external_table": "reward_points",
"sql_limit": "10000",
"producer_batch_size": "1000",
"worker_batch_size": "1000",
"sql_limit": "18000",
"producer_batch_size": "3000",
"worker_batch_size": "3000",
"sql_source": "{{this.identifier}}"
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ config (
materialized = 'view',
tags = ['streamline_non_core', 'rewards_points_spend']
tags = ['rewards_points_spend']
) }}

{{ streamline_external_table_FR_query_v2(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ config (
materialized = 'view',
tags = ['streamline_non_core', 'rewards_points_spend']
tags = ['rewards_points_spend']
) }}

{{ streamline_external_table_query_v2(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = ['_inserted_timestamp :: DATE'],
post_hook = [ "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(user_wallet_address)" ],
tags = ['streamline_non_core', 'rewards_points_spend']
tags = ['rewards_points_spend']
) }}

WITH silver_responses AS (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = ['_inserted_timestamp :: DATE'],
tags = ['streamline_non_core', 'rewards_points_spend']
tags = ['rewards_points_spend']
) }}

WITH bronze AS (
Expand Down
39 changes: 35 additions & 4 deletions models/streamline/external/streamline__evm_addresses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,25 @@
tags = ['streamline_non_core']
) }}

WITH evm_transactions AS (
WITH points_transfers AS (

SELECT
from_address,
to_address
FROM
{{ ref('silver_api__points_transfers') }}

{% if is_incremental() %}
WHERE
modified_timestamp > (
SELECT
MAX(modified_timestamp)
FROM
{{ this }}
)
{% endif %}
),
onchain AS (
SELECT
DISTINCT from_address AS address
FROM
Expand All @@ -23,6 +40,22 @@ WHERE
{{ this }}
)
{% endif %}
),
evm_addresses AS (
SELECT
DISTINCT from_address AS address
FROM
points_transfers
UNION
SELECT
DISTINCT to_address AS address
FROM
points_transfers
UNION
SELECT
DISTINCT address
FROM
onchain
)
SELECT
address,
Expand All @@ -33,8 +66,6 @@ SELECT
) }} AS evm_addresses_id,
'{{ invocation_id }}' AS _invocation_id
FROM
evm_transactions

qualify(ROW_NUMBER() over (PARTITION BY address
evm_addresses qualify(ROW_NUMBER() over (PARTITION BY address
ORDER BY
inserted_timestamp DESC)) = 1
2 changes: 1 addition & 1 deletion tests/points/tests__unique_address_count_threshold.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ SELECT
FROM
distinct_count
WHERE
ct > 7000
ct > 20000

0 comments on commit 15dcc02

Please sign in to comment.