我看到了一个 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
我想用aiosqlite和pysqlcipher3做类似的事情,而不是使用 peewee。也许它可以通过覆盖来工作,aiosqlite.Connection
但我以前从未做过这样的事情。如何将 pysqlcipher3 与 aiosqlite 一起使用?