我看到peewee的an example,其中pysqlcipher被用作管理数据库文件而不是sqlite模块的连接器。太好了,甚至还有async version of 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一起使用?
aiosqlite使用标准库sqlite3模块-并且似乎在此处进行了硬编码:
https://github.com/omnilib/aiosqlite/blob/master/aiosqlite/core.py
此外,他们到处都散布了各种sqlite3特定类型的注释,所以我不确定是否可以对其进行猴子补丁而不引起问题。