增加日志记录

This commit is contained in:
lusiyi 2023-02-23 17:35:51 +08:00
parent f223b55a5b
commit c1054df5f5
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,8 @@
import sys
import os
import config
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
@ -40,6 +43,7 @@ def generate_history_data():
if len(date_list) > 0:
for date in date_list:
if current_date == date:
config.logger.info(f"插入今天{date}的repository数据")
sql = f"""
INSERT INTO
ai_repository_history
@ -56,6 +60,7 @@ def generate_history_data():
repository
"""
else:
config.logger.info(f"插入日期{date}的repository数据")
sql = f"""
INSERT INTO
ai_repository_history
@ -82,6 +87,7 @@ def generate_history_data():
curs.execute(sql)
conn.commit()
conn.close()
config.logger.info("repository历史数据插入完成")
if __name__ == '__main__':

View File

@ -1,5 +1,8 @@
import sys
import os
import config
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
@ -43,8 +46,10 @@ def generate_statistics_data():
for date in date_list:
generate_statistics_data_single(conn, date)
config.logger.info(f"统计个人画像数据完成")
def generate_statistics_data_single(conn, date):
config.logger.info(f"统计个人画像数据:{date}")
sql = f"""select * from ai_repository_history where date_str = '{date}'"""
all_df = pd.read_sql(sql, conn)