简体   繁体   English

peewee.OperationalError:没有这样的 function:json

[英]peewee.OperationalError: no such function: json

Python version: 3.8.3 Python 版本:3.8.3

Peewee version: 3.13.3 Peewee 版本:3.13.3

I want to create an object which include a JSONField,我想创建一个包含 JSONField 的 object,

db = SqliteExtDatabase('../db.sqlite', pragmas=(('journal_mode', 'wal'), ('foreign_keys', 1)))

class Msg(BaseModel):
    id = AutoField()
    detail = JSONField()

def insert_msg(detail: dict):
    msg = Msg.create(detail=detail)
    msg.save()

but when I call the method insert_msg({"name":"abc"}) , an error comes out但是当我调用方法insert_msg({"name":"abc"})时,会出现错误

peewee.OperationalError: no such function: json

You need to have the sqlite json1 extension installed.您需要安装 sqlite json1 扩展。 Here are some links which may help:以下是一些可能有帮助的链接:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flask:peewee.OperationalError:没有这样的表: - Flask: peewee.OperationalError: no such table: peewee.OperationalError:在“ AS”附近:语法错误 - peewee.OperationalError: near “AS”: syntax error 为什么我会收到 peewee.OperationalError - Why am i getting peewee.OperationalError peewee.OperationalError:表要点没有名为name的列 - peewee.OperationalError: table gist has no column named name peewee.OperationalError:由于未完成的语句或未完成的备份而无法关闭 - peewee.OperationalError: unable to close due to unfinalized statements or unfinished backups 在python unittest中,保存Peewee对象的实例会引发peewee.IntegrityError:和peewee.OperationalError: - In python unittest, saving an instance of Peewee object raises peewee.IntegrityError: and peewee.OperationalError: peewee 多进程来自单独的数据库连接“peewee.OperationalError: 磁盘 I/O 错误” - peewee multiprocess from separate db connection 'peewee.OperationalError: disk I/O error' peewee.OperationalError:只有150行* 8列的upsert上有太多的SQL变量 - peewee.OperationalError: too many SQL variables on upsert of only 150 rows * 8 columns peewee.OperationalError:(3995,“字符集‘utf8mb4_unicode_ci’不能与调用 regexp_like 的‘binary’结合使用。”) - peewee.OperationalError: (3995, "Character set 'utf8mb4_unicode_ci' cannot be used in conjunction with 'binary' in call to regexp_like.") Peewee 模型到 JSON - Peewee model to JSON
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM