coleifer / peewee

a small, expressive orm -- supports postgresql, mysql, sqlite and cockroachdb
http://docs.peewee-orm.com/
MIT License
11.08k stars 1.37k forks source link

How to mix PooledSqliteDatabase and SqlCipherExtDatabase #2854

Closed devops-dmdx closed 6 months ago

devops-dmdx commented 6 months ago

Hi,

First thank you for this great package that, i must said, does the job and does it well!

I am wondering how could my desktop app couple PooledSqliteDatabase with SqlCipherExtDatabase? There is no such PooledSqlCipherExtDatabase already available in the playhouse.pool module.

Best, Hugo

coleifer commented 6 months ago

You'll just want to make a subclass...

from playhouse.pool import _PooledSqliteDatabase
from playhouse.sqlcipher_ext import *

class PooledSqlCipherDatabase(_PooledSqliteDatabase, SqlCipherDatabase):
    pass
devops-dmdx commented 6 months ago

Indeed, simple. Though, i generally avoid importing protected members as they "may change without prior notice".

Would it make sense to include it in peewee officially?

coleifer commented 6 months ago

You can take a look at the code in the modules referenced and see if there’s another way to accomplish your goal.