@@ -24,17 +24,27 @@ def __init__(
24
24
** kwargs : Any ,
25
25
):
26
26
"""
27
- Create a PostgreSQL connector. The connector is based on an
28
- :py:func:`aiopg.Pool` that will be created upon first use.
27
+ Create a PostgreSQL connector. The connector uses an :py:func:`aiopg.Pool`,
28
+ which is either created automatically upon first use, or set through the
29
+ py:func:`PostgresConnector.set_pool` method.
29
30
30
- All extra parameters will be passed to ``aiopg`` (see documentation__). Some
31
- parameter definitions can be modified (see below).
31
+ All other arguments than ``json_dumps`` and ``json_loads`` are passed to
32
+ ``aiopg.create_pool`` (see aiopg documentation__), with default values that
33
+ may differ from those of ``aiopg`` (see the list of parameters below).
32
34
33
35
.. _psycopg2 doc: https://www.psycopg.org/docs/extras.html#json-adaptation
34
36
.. __: https://aiopg.readthedocs.io/en/stable/core.html#aiopg.create_pool
35
37
36
38
Parameters
37
39
----------
40
+ json_dumps:
41
+ The JSON dumps function to use for serializing job arguments. Defaults to
42
+ the function used by psycopg2. See the `psycopg2 doc`_.
43
+ json_loads:
44
+ The JSON loads function to use for deserializing job arguments. Defaults
45
+ to the function used by psycopg2. See the `psycopg2 doc`_. Unused if the
46
+ pool is externally created and set into the connector through the
47
+ :py:func:`PostgresConnector.set_pool` method.
38
48
dsn (Optional[str]):
39
49
Passed to aiopg. Default is "" instead of None, which means if no argument
40
50
is passed, it will connect to localhost:5432 instead of a Unix-domain
@@ -55,17 +65,10 @@ def __init__(
55
65
maxsize (int):
56
66
Passed to aiopg. Cannot be lower than 2, otherwise worker won't be
57
67
functionning normally (one connection for listen/notify, one for executing
58
- tasks)
68
+ tasks).
59
69
minsize (int):
60
70
Passed to aiopg. Initial connections are not opened when the connector
61
71
is created, but at first use of the pool.
62
- json_dumps:
63
- The JSON dumps function to use for serializing job arguments. Defaults to
64
- the function used by psycopg2. See the `psycopg2 doc`_.
65
- json_loads:
66
- The JSON loads function to use for deserializing job arguments. Defaults
67
- to the function used by psycopg2. See the `psycopg2 doc`_. Unused if pool
68
- is passed.
69
72
"""
70
73
self ._pool : Optional [aiopg .Pool ] = None
71
74
self .json_dumps = json_dumps
0 commit comments