From cdb2976e2d2884a28ee165e68e473059f4695bb5 Mon Sep 17 00:00:00 2001 From: 0xnirmal Date: Mon, 24 Jun 2024 09:30:59 -0700 Subject: [PATCH] add coingecko table to common --- databases.csv | 1 + dbt_scripts/grant_permissions.py | 2 +- models/common/__common__sources.yml | 6 ++++++ models/common/daily_market_data.sql | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 models/common/__common__sources.yml create mode 100644 models/common/daily_market_data.sql diff --git a/databases.csv b/databases.csv index d7cf3df7..2b82f375 100644 --- a/databases.csv +++ b/databases.csv @@ -23,6 +23,7 @@ CARDANO CCTP CELESTIA CELO +COMMON COMPOUND COSMOSHUB EIGENPIE diff --git a/dbt_scripts/grant_permissions.py b/dbt_scripts/grant_permissions.py index 537c2fcd..ee4a127f 100644 --- a/dbt_scripts/grant_permissions.py +++ b/dbt_scripts/grant_permissions.py @@ -16,7 +16,7 @@ def grant_usage_to_db(db_name, role_name): if __name__ == "__main__": - asset_list = pd.read_csv("assets.csv") + asset_list = pd.read_csv("databases.csv") script = "use role accountadmin;\n" print("Generating script to grant permissions") diff --git a/models/common/__common__sources.yml b/models/common/__common__sources.yml new file mode 100644 index 00000000..7dff2ddf --- /dev/null +++ b/models/common/__common__sources.yml @@ -0,0 +1,6 @@ +sources: + - name: PC_DBT_DB_UPSTREAM + schema: prod + database: pc_dbt_db + tables: + - name: fact_coingecko_token_date_adjusted_gold diff --git a/models/common/daily_market_data.sql b/models/common/daily_market_data.sql new file mode 100644 index 00000000..3bd4661e --- /dev/null +++ b/models/common/daily_market_data.sql @@ -0,0 +1,15 @@ +{{ + config( + snowflake_warehouse="COMMON", + database="common", + schema="core", + ) +}} + +select + date, + coingecko_id, + shifted_token_price_usd as price, + shifted_token_market_cap as market_cap, + shifted_token_h24_volume_usd as h24_volume +from {{ source("PC_DBT_DB_UPSTREAM", "fact_coingecko_token_date_adjusted_gold") }} as fact_coingecko_token_date_adjusted_gold \ No newline at end of file