|
@@ -125,10 +125,17 @@ OR exploded_value = 'P0高风险' \
|
|
|
def get_video_tags_v2():
|
|
|
PROJECT = "loghubods"
|
|
|
TABLE = "loghubods.automated_updates_category_labels_1"
|
|
|
+ # now_date = datetime.today()
|
|
|
+ # date = datetime.strftime(now_date, '%Y%m%d')
|
|
|
+ # previous_date = now_date - timedelta(days=1)
|
|
|
+ # previous_date_str = datetime.strftime(previous_date, '%Y%m%d')
|
|
|
+
|
|
|
+ # 获取当前日期
|
|
|
now_date = datetime.today()
|
|
|
- date = datetime.strftime(now_date, '%Y%m%d')
|
|
|
- previous_date = now_date - timedelta(days=1)
|
|
|
- previous_date_str = datetime.strftime(previous_date, '%Y%m%d')
|
|
|
+ # 获取当前月份
|
|
|
+ current_month = now_date.strftime('%Y%m')
|
|
|
+ # 获取上个月份
|
|
|
+ previous_month = (now_date - timedelta(days=now_date.day)).strftime('%Y%m')
|
|
|
try:
|
|
|
sql = '''SELECT videoid
|
|
|
,secondary_labels
|
|
@@ -136,7 +143,7 @@ FROM loghubods.automated_updates_category_labels_1
|
|
|
WHERE (
|
|
|
dt LIKE '{}%' OR dt LIKE '{}%'
|
|
|
)
|
|
|
-'''.format(date, previous_date_str)
|
|
|
+'''.format(current_month, previous_month)
|
|
|
print("sql:" + sql)
|
|
|
records = execute_sql_from_odps(project=PROJECT, sql=sql)
|
|
|
video_tags_list = []
|