From e7f690b003ad034e96a26bcca8142dc488caeac5 Mon Sep 17 00:00:00 2001 From: tarikceric <46071768+tarikceric@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:32:43 -0700 Subject: [PATCH] delete past 6months of vote data (#871) --- .github/workflows/dbt_test_weekly.yml | 1 + models/silver/core/silver__votes.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dbt_test_weekly.yml b/.github/workflows/dbt_test_weekly.yml index b58644f9..9737d0a2 100644 --- a/.github/workflows/dbt_test_weekly.yml +++ b/.github/workflows/dbt_test_weekly.yml @@ -43,6 +43,7 @@ jobs: - name: Run DBT Jobs run: | dbt test -s "solana_models,tag:test_weekly" + dbt run -s models/silver/core/silver__votes.sql --vars '{"run_votes_cleanup": true}' notify-failure: needs: [run_dbt_jobs] diff --git a/models/silver/core/silver__votes.sql b/models/silver/core/silver__votes.sql index dec0c438..3ba8bf19 100644 --- a/models/silver/core/silver__votes.sql +++ b/models/silver/core/silver__votes.sql @@ -5,6 +5,7 @@ unique_key = "tx_id", incremental_predicates = ["dynamic_range_predicate", "block_timestamp::date"], cluster_by = ['block_timestamp::DATE','block_id','_inserted_timestamp::DATE'], + pre_hook = "{% if var('run_votes_cleanup', false) %}DELETE FROM {{ this }} WHERE _inserted_timestamp < CURRENT_DATE - INTERVAL '6 months'{% endif %}", post_hook = enable_search_optimization('{{this.schema}}','{{this.identifier}}','ON EQUALITY(tx_id)'), full_refresh = false, tags = ['scheduled_core']