|
@@ -259,10 +259,11 @@ def export_script_file(item: List[QueryWordItem]):
|
|
|
def get_script_config_lst(item: ScriptConfigLst):
|
|
|
try:
|
|
|
end_date = item.end_date + timedelta(days=1)
|
|
|
- sql = f"select * from ctop_ai_script_query_word_config " \
|
|
|
- f"where start_time >= '{item.start_date}' " \
|
|
|
- f"and start_time < '{end_date}' " \
|
|
|
- f"and ('{item.search_word}' = '' or query_word like '%%{item.search_word}%%')"
|
|
|
+ sql = f"select * from ctop_ai_script_query_word_config where config_id in " \
|
|
|
+ f"(select distinct(config_id) config_id from ctop_ai_script_query_word_config " \
|
|
|
+ f"where start_time >= '{item.start_date}' and start_time < '{end_date}' " \
|
|
|
+ f"and ('{item.search_word}' = '' or query_word like '%%{item.search_word}%%') ) "
|
|
|
+
|
|
|
org_df = pd.read_sql(sql, ai_word_engine)
|
|
|
|
|
|
g_df = org_df.groupby('config_id').apply(lambda x: pd.Series({'query_word_lst': list(x['query_word'].unique()),
|