diff --git a/databasez/sqlalchemy.py b/databasez/sqlalchemy.py index d14ad31..c66d8cc 100644 --- a/databasez/sqlalchemy.py +++ b/databasez/sqlalchemy.py @@ -268,12 +268,15 @@ def extract_options( assert param not in options value = typing.cast(str, new_query_options.pop(param)) options[param] = value.lower() in {"true", ""} - if "pool_size" in new_query_options: - assert "pool_size" not in options - options["pool_size"] = int(typing.cast(str, new_query_options["pool_size"])) + for param in ["pool_size", "max_overflow"]: + if param in new_query_options: + assert param not in options + options[param] = int(typing.cast(str, new_query_options.pop(param))) if "pool_recycle" in new_query_options: assert "pool_recycle" not in options - options["pool_recycle"] = int(typing.cast(str, new_query_options["pool_recycle"])) + options["pool_recycle"] = float( + typing.cast(str, new_query_options.pop("pool_recycle")) + ) return database_url.replace(options=new_query_options), options def json_serializer(self, inp: dict) -> str: diff --git a/docs/connections-and-transactions.md b/docs/connections-and-transactions.md index dfdf96c..9a4595e 100644 --- a/docs/connections-and-transactions.md +++ b/docs/connections-and-transactions.md @@ -125,11 +125,12 @@ Options which will be transformed are in `databasez/sqlalchemy.py` in `extract_o Some transformed options are: -- ssl: enable ssl -- echo: enable echo -- echo_pool: enable echo for pool -- pool_size: maximal amount of connections -- pool_recycle: maximal duration a connection may live +- ssl: enable ssl. +- echo: enable echo. +- echo_pool: enable echo for pool. +- pool_size: maximal amount of connections, int (former name: min_size). +- max_overflow: maximal amount of connections, int (former name: max_size). +- pool_recycle: maximal duration a connection may live, float. ## Connection options as a dictionary