data_job/job_one_game.py
2025-03-06 09:37:17 +08:00

57 lines
1.5 KiB
Python

from utils.read_sql_files import read_one_game_sql_files
from utils.execute_sql import select_execute_sql
from utils.read_sql_files import read_sql_files
def dim(game_information):
read_one_game_sql_files('dim', game_information)
def dwd(game_information):
read_one_game_sql_files('dwd_before', game_information)
read_one_game_sql_files('dwd_after', game_information)
def dws(game_information):
read_one_game_sql_files('dws_before', game_information)
read_one_game_sql_files('dws_after', game_information)
def ads(game_information):
read_one_game_sql_files('ads', game_information)
def job_one_game():
sql_params = "49,50,51"
sql_str = f"select relation_id,game_channel_id,game_identity,game_platform_id from dim.game_product_relation where relation_id IN ({sql_params})"
game_information = select_execute_sql(sql_str)
for game in game_information:
game_information_dic = {
"${relation_id}": str(game[0]),
"${channel_id}": str(game[1]),
"${game_identity}": game[2],
"${platform_id}": str(game[3])
}
print(game_information_dic)
# dim(game_information_dic)
# dwd(game_information_dic)
# dws(game_information_dic)
# ads(game_information_dic)
def rerun():
# read_sql_files('dim')
read_sql_files('dwd_before')
read_sql_files('dwd_after')
read_sql_files('dws_before')
read_sql_files('dws_after')
read_sql_files('ads')
if __name__ == '__main__':
rerun()