获取信息:
# 指定数据库
R_profile.objects.using('db4').get(project_id=1, user_id =1)
# 不指定数据库
R_profile.objects.get(project_id=1, user_id =1)
# 根据条件更新sql信息
lg = Log.objects.get(project_id=1, user_id = 1)
lg.code =0
lg.save()
# 插入数据
lg = Log(project_id= 1, user_id = 1, code = 0)
lg.save((using='db4') # 用默认数据库的话就括号是空
网友评论