diff --git a/README.md b/README.md index db50c9c..d91d8c5 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,22 @@ users may find useful: to you, if you need to pin your usage to a particular, supported WherobotsDB version. Defaults to `"latest"`. * `session_type`: `"single"` or `"multi"`; if set to `"single"`, then - each call to `connect()` establishes an exclusive connection to a - distinct and dedicated Wherobots runtime; if set to "multi", then - multiple `connect()` calls with the same arguments and credentials - will connect to the same shared Wherobots runtime; `"multi"` is the - default. - - Consider multi-session for potential cost savings, but be mindful of - performance impacts from shared resources. You might need to adjust - cluster size if slowdowns occur, which could affect overall cost. + each call to `connect()` establishes an exclusive connection to a + distinct and dedicated Wherobots runtime; if set to "multi", then + multiple `connect()` calls with the same arguments and credentials + will connect to the same shared Wherobots runtime; `"multi"` is the + default. + + Consider multi-session for potential cost savings, but be mindful of + performance impacts from shared resources. You might need to adjust + cluster size if slowdowns occur, which could affect overall cost. +* `shutdown_after_inactive_seconds`: how long the runtime waits and + stays running after all clients have disconnected. This delay gives + an opportunity for clients to reconnect to a previously-established + runtime without having to start a new one. + + If you're using a simple "connect-query-disconnect" pattern from + your application, you can set this parameter to a value greater than + your expected time between queries and effectively get a continuously + running SQL session runtime without any complex connection management + in your application. diff --git a/pyproject.toml b/pyproject.toml index e94eeaa..fc98594 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "wherobots-python-dbapi" -version = "0.19.0" +version = "0.20.0" description = "Python DB-API driver for Wherobots DB" authors = [{ name = "Maxime Petazzoni", email = "max@wherobots.com" }] -requires-python = "~=3.8" +requires-python = ">=3.8, <4" readme = "README.md" license = "Apache-2.0" dependencies = [ diff --git a/tests/smoke.py b/tests/smoke.py index d12a80d..06a0ddf 100644 --- a/tests/smoke.py +++ b/tests/smoke.py @@ -14,6 +14,7 @@ from wherobots.db.constants import DEFAULT_ENDPOINT, DEFAULT_SESSION_TYPE from wherobots.db.connection import Connection from wherobots.db.region import Region +from wherobots.db.runtime import Runtime from wherobots.db.session_type import SessionType if __name__ == "__main__": @@ -21,6 +22,7 @@ parser.add_argument("--api-key-file", help="File containing the API key") parser.add_argument("--token-file", help="File containing the token") parser.add_argument("--region", help="Region to connect to (ie. aws-us-west-2)") + parser.add_argument("--runtime", help="Runtime type (ie. tiny)") parser.add_argument("--version", help="Runtime version (ie. latest)") parser.add_argument( "--session-type", @@ -83,6 +85,7 @@ api_key=api_key, shutdown_after_inactive_seconds=args.shutdown_after_inactive_seconds, wait_timeout=900, + runtime=Runtime(args.runtime) if args.runtime else Runtime.MICRO, region=Region(args.region) if args.region else Region.AWS_US_WEST_2, version=args.version, session_type=SessionType(args.session_type), diff --git a/uv.lock b/uv.lock index 1bcd952..1d73065 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.8, <4" resolution-markers = [ "python_full_version >= '3.12'", @@ -1593,7 +1593,7 @@ wheels = [ [[package]] name = "wherobots-python-dbapi" -version = "0.19.0" +version = "0.20.0" source = { editable = "." } dependencies = [ { name = "cbor2" }, diff --git a/wherobots/db/runtime.py b/wherobots/db/runtime.py index 0872159..7458666 100644 --- a/wherobots/db/runtime.py +++ b/wherobots/db/runtime.py @@ -2,6 +2,7 @@ class Runtime(Enum): + MICRO = "micro" TINY = "tiny" SMALL = "small" MEDIUM = "medium"