各位晚上好,
问题描述:我在navicat为数据库表增加的一个字段后,pycharm一直显示无法解析列(数据库确实有这列)
代码段:file_path_org列无法解析
def history_img(user_id,detection_type,file_path_org,file_path,detection_result):
db_session.execute(
text(
"INSERT INTO detection_records (user_id,detection_type,file_path_org,file_path,detection_result) VALUES (:user_id,:detection_type,:file_path_org,:file_path,:detection_result)"),
{'user_id': user_id, 'detection_type': detection_type, 'file_path_org': file_path_org, 'file_path': file_path, 'detection_result': detection_result}
)
db_session.commit()
数据库链接是这样的:
engine = create_engine('mysql+pymysql://root:262250zby@localhost:3306/app?charset=utf8mb4')
Session = sessionmaker(bind=engine)
db_session = Session()
尝试过的的解决办法:
使用
date = db_session.execute(
text('select * from detection_records'))
是可以打印出file_path_org列的
我也尝试将数据库复制一个出来,然后重新建立数据库链接但是还是不行
还尝试了清除文件系统缓存和本地历史记录、将下载的共享索引标记为已排除然后重启idea依然无法解析file_path_org列