Skip to content

Commit

Permalink
Merge pull request #681 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
优化数据分析 页面运转 数据库不存在的异常提示
  • Loading branch information
Ikaros-521 committed Mar 2, 2024
2 parents 6d59285 + 057c966 commit c81093d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions utils/data_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import jieba
from collections import Counter
import os

from .common import Common
from .logger import Configure_logger
Expand Down Expand Up @@ -81,7 +82,11 @@ def get_comment_word_cloud_option(self, top_num=10):
dict: nicegui绘制图表的option
"""
try:
db = SQLiteDB(self.config.get("database", "path"))
if not os.path.exists(self.config.get('database', 'path')):
logging.warning(f"数据库:{self.config.get('database', 'path')} 不存在,如果您是第一次启动项目,且没有 运行的情况下,那么请忽略此报错信息,正常运行后,会自动创建数据库,无须担心")
return None

db = SQLiteDB(self.config.get('database', 'path'))

# 查询数据
select_data_sql = '''
Expand Down Expand Up @@ -145,7 +150,11 @@ def get_integral_option(self, type="integral", top_num=10):
dict: nicegui绘制图表的option
"""
try:
db = SQLiteDB(self.config.get("database", "path"))
if not os.path.exists(self.config.get('database', 'path')):
logging.warning(f"数据库:{self.config.get('database', 'path')} 不存在,如果您是第一次启动项目,且没有 运行的情况下,那么请忽略此报错信息,正常运行后,会自动创建数据库,无须担心")
return None

db = SQLiteDB(self.config.get('database', 'path'))

# 查询数据
select_data_sql = f'''
Expand Down Expand Up @@ -305,7 +314,11 @@ def get_gift_option(self, top_num=10):
dict: nicegui绘制图表的option
"""
try:
db = SQLiteDB(self.config.get("database", "path"))
if not os.path.exists(self.config.get('database', 'path')):
logging.warning(f"数据库:{self.config.get('database', 'path')} 不存在,如果您是第一次启动项目,且没有 运行的情况下,那么请忽略此报错信息,正常运行后,会自动创建数据库,无须担心")
return None

db = SQLiteDB(self.config.get('database', 'path'))

# 查询数据
select_data_sql = f'''
Expand Down

0 comments on commit c81093d

Please sign in to comment.