-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: finalize funding event data
- Loading branch information
Showing
4 changed files
with
64 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 13 additions & 6 deletions
19
warehouse/dbt/models/staging/gitcoin/stg_gitcoin__donations.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
with max_dlt as ( | ||
select max(_dlt_load_id) as max_dlt_load_id | ||
from {{ source("gitcoin", "all_donations") }} | ||
) | ||
|
||
select distinct | ||
`source` as gitcoin_data_source, | ||
`timestamp` as donation_timestamp, | ||
round_id, | ||
round_id as gitcoin_round_id, | ||
round_num as round_number, | ||
round_name, | ||
chain_id, | ||
project_id as gitcoin_project_id, | ||
amount_in_usd, | ||
LOWER(recipient_address) as project_recipient_address, | ||
LOWER(donor_address) as donor_address, | ||
LOWER(transaction_hash) as transaction_hash, | ||
TRIM(project_name) as project_application_title | ||
lower(recipient_address) as project_recipient_address, | ||
lower(donor_address) as donor_address, | ||
lower(transaction_hash) as transaction_hash, | ||
trim(project_name) as project_application_title | ||
from {{ source("gitcoin", "all_donations") }} | ||
where amount_in_usd > 0 | ||
where | ||
amount_in_usd > 0 | ||
and _dlt_load_id = (select max_dlt.max_dlt_load_id from max_dlt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters