Python 存入mysql报错,看不出来是什么问题求解答

json转字典 存入mysql 报错 Python3.5 django1.82以上
字典:
dialogue={

"state": "ok",
"errmsg": "",
"data": {
    "total": 26,
    "items": [
        {
            "id": "83013",
            "session_id": "664565",
            "chat_id": "5464",
            "site_id": "5464",
            "visitor_id": "645645",
            "worker_id": "65466",
            "interface": "554",
            "entry_type": "44",
            "finished_type": "45",
            "total_messages": "17",
            "visitor_messages": "9",
            "robot_messages": "2",
            "miss_messages": "9",
            "worker_messages": "6",
            "wait_times": "0",
            "total_times": "531",
            "server_date": "2017-05-01",
            "first_time": "2017-05-01 22:17:57",
            "last_time": "2017-05-01 22:26:48",
            "first_resp": "22632",
            "avg_resp": "28985",
            "robot_tags": "",
            "manual_tags": ""
        },
        {
             "id": "83013",
            "session_id": "664565",
            "chat_id": "5464",
            "site_id": "5464",
            "visitor_id": "645645",
            "worker_id": "65466",
            "interface": "554",
            "entry_type": "44",
            "finished_type": "45",
            "total_messages": "17",
            "visitor_messages": "9",
            "robot_messages": "2",
            "miss_messages": "9",
            "worker_messages": "6",
            "wait_times": "0",
            "total_times": "531",
            "server_date": "2017-05-01",
            "first_time": "2017-05-01 22:17:57",
            "last_time": "2017-05-01 22:26:48",
            "first_resp": "22632",
            "avg_resp": "28985",
            "robot_tags": null,
            "manual_tags": null
        }]}}
        -------------------------------------------
       代码:
        for records in dialogue['data']['items']:
    dialogue_records = Dialogue.objects.all()
    dialogue_validation = dialogue_records.filter(session_id=records['session_id'], chat_id=records['chat_id'])
    if not dialogue_validation:
        print("数据不存在,添加添加数据中ing....")
        Dialogue.objects.create(session_id=records['session_id'], chat_id=records['chat_id'],
                                site_id=records['site_id'],
                                visitor_id=records['visitor_id'], worker_id=records['worker_id'],
                                interface=records['interface'],
                                entry_type=records['entry_type'], finished_type=records['finished_type'],
                                total_messages=records['total_messages'],
                                visitor_messages=records['visitor_messages'],
                                robot_messages=records['robot_messages'], miss_messages=records['miss_messages'],
                                worker_messages=records['worker_messages'], wait_times=records['wait_times'],
                                total_times=records['total_times'],
                                server_date=records['server_date'], first_time=records['first_time'],
                                last_time=records['last_time'], first_resp=['first_resp'],
                                avg_resp=records['avg_resp'], robot_tags=records['robot_tags'],
                                manual_tags=records['manual_tags'])
                                ------------------===========
                                
                            
                             

clipboard.png 报错

clipboard.png

clipboard.png

阅读 3k
2 个回答

model 问题我model 咩设计好 出现的

类型转换错误 列表不能通过函数int()转成整型值

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题