1

我看到了一个 peewee 的例子,其中 pysqlcipher 被用作管理数据库文件而不是 sqlite 模块的连接器。太好了,甚至还有peewee 的异步版本,但我不需要(或不想)使用 peewee 的对象模型。在 peewee 中,连接器的初始化如下:

from peewee import *
from playhouse.sqlcipher_ext import SqlCipherDatabase

db = SqlCipherDatabase(None)

class Entry(Model):

    class Meta:
        database = db

我想用aiosqlitepysqlcipher3做类似的事情,而不是使用 peewee。也许它可以通过覆盖来工作,aiosqlite.Connection但我以前从未做过这样的事情。如何将 pysqlcipher3 与 aiosqlite 一起使用?

4

1 回答 1

0

aiosqlite 使用标准库 sqlite3 模块——这里似乎是硬编码的:

https://github.com/omnilib/aiosqlite/blob/master/aiosqlite/core.py

此外,他们在各处散布了各种特定于 sqlite3 的类型注释,所以我不确定您是否可以在不引起问题的情况下对其进行猴子修补。

于 2020-05-01T00:52:15.037 回答