sdss / sdssdb

Central SDSS product for database management
https://sdssdb.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

support peewee connection pooling #236

Open havok2063 opened 8 months ago

havok2063 commented 8 months ago

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.

albireox commented 8 months ago

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.