Untitled
public
Feb 12, 2024
Never
63
1 def load_data(redshift_conn_params): 2 """ Executes a query on the designated Redshift cluster and returns a dataframe""" 3 query=f"""select activeday, 4 datacenter, 5 pid, 6 brand, 7 dcinternaluserid, 8 ipcountrycode, 9 jurisdictioncode, 10 regcountrycode, 11 gameid, 12 channel, 13 isfreegame, 14 currency, 15 exchangerate, 16 avgrtp, 17 sum(rounds) as "rounds", 18 sum(basebet) as "basebet", 19 sum(basewin) as "basewin", 20 sum(basejploss) as "basejploss", 21 sum(basejpwin) as "basejpwin", 22 sum(baseggr) as "baseggr", 23 sum(baseggrjpinlc) as "baseggrjpinlc", 24 y, m, d 25 FROM "etl_dev"."transactions_daily_aggregation" 26 WHERE activeday >= '2022-01-01' and activeday < '2022-02-01' 27 GROUP BY activeday, datacenter, pid, brand, dcinternaluserid, ipcountrycode, jurisdictioncode, regcountrycode, gameid, channel, isfreegame, currency, exchangerate, avgrtp, y, m, d 28 """ 29 conn = redshift_connector.connect(**redshift_conn_params) 30 cursor = conn.cursor() 31 # Query and receive result set 32 cursor.execute(query) 33 result: pd.DataFrame = cursor.fetch_dataframe() 34 return result