Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kalombos committed Sep 14, 2024
1 parent 3f7b9df commit 5703588
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ peewee-async
* Works on Python 3.8+
* Has support for PostgreSQL via `aiopg`
* Has support for MySQL via `aiomysql`
* Asynchronous analogues of peewee sync methods with prefix aio_
* Asynchronous analogues of peewee sync methods with prefix **aio_**
* Drop-in replacement for sync code, sync will remain sync
* Basic operations are supported
* Transactions support is present
Expand Down
29 changes: 25 additions & 4 deletions peewee_async/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@


class AioDatabase(peewee.Database):
"""Base async database driver providing **single drop-in sync**
connection and **async connections pool** interface.
:param pool_params: parameters that are passed to the pool
:param min_connections: min connections pool size. Alias for pool_params.minsize
:param max_connections: max connections pool size. Alias for pool_params.maxsize
Example::
database = PooledPostgresqlExtDatabase(
'test',
'min_connections': 1,
'max_connections': 5,
'pool_params': {"timeout": 30, 'pool_recycle': 1.5}
)
See also:
https://peewee.readthedocs.io/en/latest/peewee/api.html#Database
"""

_allow_sync = True # whether sync queries are allowed

pool_backend_cls: Type[PoolBackend]
Expand Down Expand Up @@ -161,6 +181,9 @@ async def aio_execute(self, query: Any, fetch_results: Optional[FetchResults] =
class PooledPostgresqlDatabase(AioDatabase, peewee.PostgresqlDatabase):
"""Extension for `peewee.PostgresqlDatabase` providing extra methods
for managing async connection.
See also:
https://peewee.readthedocs.io/en/latest/peewee/api.html#PostgresqlDatabase
"""

pool_backend_cls = PostgresqlPoolBackend
Expand All @@ -178,11 +201,11 @@ class PooledPostgresqlExtDatabase(
PooledPostgresqlDatabase,
ext.PostgresqlExtDatabase
):
"""PosgreSQL database extended driver providing **single drop-in sync**
"""PosgtreSQL database extended driver providing **single drop-in sync**
connection and **async connections pool** interface.
JSON fields support is enabled by default, HStore supports is disabled by
default, but can be enabled or through pool_params with ``register_hstore=False`` argument.
default, but can be enabled through pool_params or with ``register_hstore=False`` argument.
Example::
Expand All @@ -203,8 +226,6 @@ class PooledMySQLDatabase(AioDatabase, peewee.MySQLDatabase):
"""MySQL database driver providing **single drop-in sync**
connection and **async connections pool** interface.
:param max_connections: connections pool size
Example::
database = PooledMySQLDatabase('test', max_connections=10)
Expand Down

0 comments on commit 5703588

Please sign in to comment.