import os
import sys
sys.path.append(os.path.dirname(sys.path[0]))
from utils.secure_db_client import get_remote_engine


engine = get_remote_engine(
    site_name="us",          # -> database "selection"
    db_type="postgresql_cluster",         # -> 服务端 alias "mysql"
	user="fangxingjun",         # -> 服务端 alias "mysql"
    user_token="5f1b2e9c3a4d7f60"   # 可不传，走默认
)

site_name = 'us'
date_type = 'month_aba_me'
date_info = '2025-11'
partitions = {
    'site_name': site_name,
    'date_type': date_type,
    'date_info': date_info,
}
cols_list = ['search_term', 'total_searched_products', 'mt_volume', 'st_price_avg', 'st_ao_val', 'total_amazon_orders_per50', 'total_bsr_orders', 'total_page3_products', 'total_self_products', 'total_new_products', 'total_orders', 'total_amazon_orders', 'self_product_rate', 'new_product_rate', 'created_time', 'updated_time', 'site_name', 'date_type', 'date_info']
engine.sqoop_raw_export(
    hive_table='dwt_st_mt_christmas_info',
    import_table=f'{site_name}_st_mt_christmas_report_2025',
    partitions=partitions,
    m=1,
    cols=','.join(cols_list)
)