import os
import sys

from utils.common_util import CommonUtil

sys.path.append(os.path.dirname(sys.path[0]))

if __name__ == '__main__':


    current_month = CommonUtil.reformat_date("2023-03-13", "%Y-%m-%d", "%Y-%m", )

    print(current_month)

    #  todo
    #  查询最近分区

    # spark = SparkUtil.get_spark_session("wjc_test")
    #
    # df_dwt_flow_asin_part = CommonUtil.select_partitions_df(spark, "dwt_flow_asin")
    # df_dwt_flow_asin_part.show()
    #
    # df_dwt_flow_asin_part = df_dwt_flow_asin_part \
    #     .where(f"date_type = '{DateTypes.last30day.name}' and site_name = 'us' ")
    # df_dwt_flow_asin_part.show()
    #
    # dwt_flow_asin_last_day = df_dwt_flow_asin_part.selectExpr("max(date_info)").collect()[0]
    #
    # print(dwt_flow_asin_last_day)
