Sqlalchemy has connection pooling built-in to its database connection that you can easily access/set up. Can we, or should we, implement a similar connection pooling for peewee? Peewee has this feature but as a separate class, https://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pool. This might be as simple as switching out the PostgresqlDatabase class for the PooledPostgresqlDatabase class in our PeeweeDatabaseConnection, or perhaps creating another connection class altogether in sdssdb. I think ideally we'd want the former.
This sounds like a good idea. I gave it a very quick test in this PR but it seems it's a bit more complicated than changing PostgresqlDatabase to PooledPostgresqlExtDatabase, although maybe I missed something. See comments there.
Sqlalchemy has connection pooling built-in to its database connection that you can easily access/set up. Can we, or should we, implement a similar connection pooling for peewee? Peewee has this feature but as a separate class, https://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pool. This might be as simple as switching out the
PostgresqlDatabase
class for thePooledPostgresqlDatabase
class in ourPeeweeDatabaseConnection
, or perhaps creating another connection class altogether insdssdb
. I think ideally we'd want the former.