diff --git a/models/gold/defi/defi__fact_solar_dex_tvl.sql b/models/gold/defi/defi__fact_solar_dex_tvl.sql index a974600..7158ab6 100644 --- a/models/gold/defi/defi__fact_solar_dex_tvl.sql +++ b/models/gold/defi/defi__fact_solar_dex_tvl.sql @@ -1,21 +1,24 @@ {{ config( materialized = 'incremental', - unique_key = ["block_date"], tags = ['scheduled_non_core'] ) }} WITH lq AS ( SELECT - {{ target.database }}.live.udf_api('https://api.solarstudios.co/main/info') :data :data AS response + {{ target.database }}.live.udf_api( + '{Service}main/info', + 'Vault/prod/eclipse/solar_dex' + ) :data :data AS response ) SELECT - SYSDATE() :: DATE AS block_date, + SYSDATE() AS recorded_at, + 'sooGfQwJ6enHfLTPfasFZtFR7DgobkJD77maDNEqGkD' AS program_id, response :tvl :: FLOAT AS tvl, response :users :: INT AS users, response :volume24 :: FLOAT AS volume_24, {{ dbt_utils.generate_surrogate_key( - ['block_date'] + ['recorded_at'] ) }} AS fact_solar_dex_tvl_id, SYSDATE() AS inserted_timestamp, SYSDATE() AS modified_timestamp diff --git a/models/gold/defi/defi__fact_solar_dex_tvl.yml b/models/gold/defi/defi__fact_solar_dex_tvl.yml index 228fd0f..c9e79d5 100644 --- a/models/gold/defi/defi__fact_solar_dex_tvl.yml +++ b/models/gold/defi/defi__fact_solar_dex_tvl.yml @@ -2,10 +2,22 @@ version: 2 models: - name: defi__fact_solar_dex_tvl description: Contains tvl for solar dex - data starts as of 2024-11-25 + recent_date_filter: &recent_date_filter + config: + where: modified_timestamp >= current_date - 7 columns: - - name: BLOCK_DATE - description: "{{ doc('block_timestamp') }}" + - name: recorded_at + description: "the data the tvl was recorded" data_tests: - dbt_expectations.expect_row_values_to_have_recent_data: datepart: day - interval: 2 \ No newline at end of file + interval: 2 + - name: tvl + data_tests: + - not_null: *recent_date_filter + - name: users + data_tests: + - not_null: *recent_date_filter + - name: volume_24 + data_tests: + - not_null: *recent_date_filter \ No newline at end of file