From 23ac9f3d69d5b0e6c9632ace4eb460d60b1fb14d Mon Sep 17 00:00:00 2001 From: Diana Shalai Date: Fri, 19 Sep 2025 17:23:29 +0200 Subject: [PATCH 1/3] refactor: remove unused dim1_campaign model and its configuration --- models/80_marts/dim1_campaign.sql | 9 --------- models/80_marts/dim1_campaign.yml | 14 -------------- 2 files changed, 23 deletions(-) delete mode 100644 models/80_marts/dim1_campaign.sql delete mode 100644 models/80_marts/dim1_campaign.yml diff --git a/models/80_marts/dim1_campaign.sql b/models/80_marts/dim1_campaign.sql deleted file mode 100644 index 0a68c4a..0000000 --- a/models/80_marts/dim1_campaign.sql +++ /dev/null @@ -1,9 +0,0 @@ -with - campaign_data as ( - select distinct campaign_id as id, campaign_name - from {{ ref("int_paid__all_paid") }} - qualify row_number() over (partition by campaign_id order by date_day) = 1 - ) - -select * -from campaign_data diff --git a/models/80_marts/dim1_campaign.yml b/models/80_marts/dim1_campaign.yml deleted file mode 100644 index c1ed480..0000000 --- a/models/80_marts/dim1_campaign.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 -models: - - name: dim1_campaign - columns: - - name: id - description: The ID of the campaign. - config: - meta: {} - tags: [] - - name: campaign_name - description: The name of the campaign. - config: - meta: {} - tags: [] From 19e1e0f4c8a5b6c00f3047e5e94b970f4ac0f259 Mon Sep 17 00:00:00 2001 From: Diana Shalai Date: Fri, 19 Sep 2025 17:58:06 +0200 Subject: [PATCH 2/3] feat: add principal, interest, collateral, and stake columns to fct_loans model --- models/80_marts/fct_loans.sql | 4 ++++ models/80_marts/fct_loans.yml | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/models/80_marts/fct_loans.sql b/models/80_marts/fct_loans.sql index 5796918..7c9ac3c 100644 --- a/models/80_marts/fct_loans.sql +++ b/models/80_marts/fct_loans.sql @@ -9,6 +9,10 @@ with canonical_segment_id as fk_dim1__users, borrower as fk_dim1__borrower, collateral_usd_value, + principal, + interest, + collateral, + stake, 1 as loan_count, date(record_timestamp) as record_date, case when operation = 'new_loan' then 1 else 0 end as new_loan_count, diff --git a/models/80_marts/fct_loans.yml b/models/80_marts/fct_loans.yml index 8502490..e5fad2f 100644 --- a/models/80_marts/fct_loans.yml +++ b/models/80_marts/fct_loans.yml @@ -20,6 +20,30 @@ models: meta: {} tags: [] description: '' + - name: principal + data_type: FLOAT64 + config: + meta: {} + tags: [] + description: '' + - name: interest + data_type: FLOAT64 + config: + meta: {} + tags: [] + description: '' + - name: collateral + data_type: FLOAT64 + config: + meta: {} + tags: [] + description: '' + - name: stake + data_type: FLOAT64 + config: + meta: {} + tags: [] + description: '' - name: collateral_usd_value data_type: FLOAT64 config: From d18a91793fa9252441328954dcc02873d9cbe869 Mon Sep 17 00:00:00 2001 From: Diana Shalai Date: Mon, 22 Sep 2025 12:01:21 +0200 Subject: [PATCH 3/3] refactor: remove unused foreign key columns from fact tables --- models/80_marts/fct_assets_locked.sql | 1 - models/80_marts/fct_assets_locked.yml | 6 ------ models/80_marts/fct_donated.sql | 1 - models/80_marts/fct_donated.yml | 6 ------ models/80_marts/fct_liquidation.sql | 1 - models/80_marts/fct_liquidation.yml | 6 ------ models/80_marts/fct_loans.sql | 1 - models/80_marts/fct_loans.yml | 6 ------ models/80_marts/fct_orders.sql | 5 +---- models/80_marts/fct_orders.yml | 6 ------ 10 files changed, 1 insertion(+), 38 deletions(-) diff --git a/models/80_marts/fct_assets_locked.sql b/models/80_marts/fct_assets_locked.sql index 09465c2..b6ca1a6 100644 --- a/models/80_marts/fct_assets_locked.sql +++ b/models/80_marts/fct_assets_locked.sql @@ -8,7 +8,6 @@ with sequence_number as id, canonical_segment_id as fk_dim1__users, transaction_hash as fk_transaction_hash, - recipient as fk_dim1__recipient, token_adress as fk_token_adress, amount, token_usd_value, diff --git a/models/80_marts/fct_assets_locked.yml b/models/80_marts/fct_assets_locked.yml index b2d08fe..7d046aa 100644 --- a/models/80_marts/fct_assets_locked.yml +++ b/models/80_marts/fct_assets_locked.yml @@ -20,12 +20,6 @@ models: meta: {} tags: [] description: '' - - name: fk_dim1__recipient - data_type: STRING - config: - meta: {} - tags: [] - description: '' - name: fk_token_adress data_type: STRING config: diff --git a/models/80_marts/fct_donated.sql b/models/80_marts/fct_donated.sql index 0cdf22e..3be6470 100644 --- a/models/80_marts/fct_donated.sql +++ b/models/80_marts/fct_donated.sql @@ -5,7 +5,6 @@ with select transaction_hash as id, canonical_segment_id as fk_dim1__users, - donor as fk_dim1__donor, amount, 1 as donation_count, date(record_timestamp) as record_date, diff --git a/models/80_marts/fct_donated.yml b/models/80_marts/fct_donated.yml index 2a95e47..cf3549b 100644 --- a/models/80_marts/fct_donated.yml +++ b/models/80_marts/fct_donated.yml @@ -8,12 +8,6 @@ models: meta: {} tags: [] description: '' - - name: fk_dim1__donor - data_type: STRING - config: - meta: {} - tags: [] - description: '' - name: fk_dim1__users data_type: STRING config: diff --git a/models/80_marts/fct_liquidation.sql b/models/80_marts/fct_liquidation.sql index c721bfe..462c476 100644 --- a/models/80_marts/fct_liquidation.sql +++ b/models/80_marts/fct_liquidation.sql @@ -8,7 +8,6 @@ with id, transaction_hash as fk_transaction_hash, canonical_segment_id as fk_dim1__users, - borrower as fk_dim1__borrower, coll_gas_compensation, gas_compensation, liquidated_principal, diff --git a/models/80_marts/fct_liquidation.yml b/models/80_marts/fct_liquidation.yml index 58150b3..21aff9a 100644 --- a/models/80_marts/fct_liquidation.yml +++ b/models/80_marts/fct_liquidation.yml @@ -50,12 +50,6 @@ models: meta: {} tags: [] description: '' - - name: fk_dim1__borrower - data_type: STRING - config: - meta: {} - tags: [] - description: '' - name: record_date data_type: DATE config: diff --git a/models/80_marts/fct_loans.sql b/models/80_marts/fct_loans.sql index 7c9ac3c..9a57c28 100644 --- a/models/80_marts/fct_loans.sql +++ b/models/80_marts/fct_loans.sql @@ -7,7 +7,6 @@ with select transaction_hash as id, canonical_segment_id as fk_dim1__users, - borrower as fk_dim1__borrower, collateral_usd_value, principal, interest, diff --git a/models/80_marts/fct_loans.yml b/models/80_marts/fct_loans.yml index e5fad2f..f3f078f 100644 --- a/models/80_marts/fct_loans.yml +++ b/models/80_marts/fct_loans.yml @@ -14,12 +14,6 @@ models: meta: {} tags: [] description: '' - - name: fk_dim1__borrower - data_type: STRING - config: - meta: {} - tags: [] - description: '' - name: principal data_type: FLOAT64 config: diff --git a/models/80_marts/fct_orders.sql b/models/80_marts/fct_orders.sql index 1dde843..4c3a8b2 100644 --- a/models/80_marts/fct_orders.sql +++ b/models/80_marts/fct_orders.sql @@ -5,10 +5,7 @@ with select order_id as id, canonical_segment_id as fk_dim1__users, - transaction_hash as fk_transaction_hash, -- check --> - -- transaction_hash or order_id as id - customer as fk_dim1__customer, -- check --> - -- customer or canonical_segment_id or both + transaction_hash as fk_transaction_hash, product_id as fk_dim1__products, price, 1 as order_count, diff --git a/models/80_marts/fct_orders.yml b/models/80_marts/fct_orders.yml index bddbf2f..9315126 100644 --- a/models/80_marts/fct_orders.yml +++ b/models/80_marts/fct_orders.yml @@ -8,12 +8,6 @@ models: meta: {} tags: [] description: '' - - name: fk_dim1__customer - data_type: STRING - config: - meta: {} - tags: [] - description: '' - name: fk_transaction_hash data_type: STRING config: