Skip to content

Commit

Permalink
fix extractions, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Aug 19, 2024
1 parent 60eeb11 commit db2c2a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 7 additions & 4 deletions databasez/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions docs/connections-and-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db2c2a8

Please sign in to comment.