peewee.DataError: string or blob too big, How to increase `DSQLITE_MAX_VARIABLE_NUMBER` in peewee?
peewee.DataError: string or blob too big, How to increase `DSQLITE_MAX_VARIABLE_NUMBER` in peewee?
我想使用 peewee ORM 在 SQLite 数据库中存储 1.5 GB 的二进制数据。
我得到 peewee.DataError: string or blob too big
。我能以某种方式改变 peewee 的限制吗?
如何在 peewee 中增加 DSQLITE_MAX_VARIABLE_NUMBER
?
关于您的问题,"How to increase DSQLITE_MAX_VARIABLE_NUMBER in peewee?" -- 这是一个编译时选项,因此您需要重新编译 SQLite 并指定一个新值。但是,我不认为这是针对您的问题的正确编译时选项。
我想建议这是一个非常大的 "binary blob" 要存储在 SQLite 中。您可能会遇到 blob/string 的 SQLite 最大长度:https://www.sqlite.org/limits.html#max_length——要更改此设置,您需要重新编译 SQLite 并指定新的所需最大值。
对于非常大的 blob,您还可以考虑使用 Peewee 支持的类似 SQLite blob 文件的 API(尽管它们的用法是一个相当小众的主题,您需要阅读 SQLite 文档以获得很好地理解它是如何工作的):http://docs.peewee-orm.com/en/latest/peewee/sqlite_ext.html#sqlite-blob
最后,仅将 BLOB 保留在文件系统(擅长存储大文件)并仅引用数据库中的文件名会有什么问题?
我想使用 peewee ORM 在 SQLite 数据库中存储 1.5 GB 的二进制数据。
我得到 peewee.DataError: string or blob too big
。我能以某种方式改变 peewee 的限制吗?
如何在 peewee 中增加 DSQLITE_MAX_VARIABLE_NUMBER
?
关于您的问题,"How to increase DSQLITE_MAX_VARIABLE_NUMBER in peewee?" -- 这是一个编译时选项,因此您需要重新编译 SQLite 并指定一个新值。但是,我不认为这是针对您的问题的正确编译时选项。
我想建议这是一个非常大的 "binary blob" 要存储在 SQLite 中。您可能会遇到 blob/string 的 SQLite 最大长度:https://www.sqlite.org/limits.html#max_length——要更改此设置,您需要重新编译 SQLite 并指定新的所需最大值。
对于非常大的 blob,您还可以考虑使用 Peewee 支持的类似 SQLite blob 文件的 API(尽管它们的用法是一个相当小众的主题,您需要阅读 SQLite 文档以获得很好地理解它是如何工作的):http://docs.peewee-orm.com/en/latest/peewee/sqlite_ext.html#sqlite-blob
最后,仅将 BLOB 保留在文件系统(擅长存储大文件)并仅引用数据库中的文件名会有什么问题?