Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ users may find useful:
convenient for human inspection while still being usable by
libraries like Shapely.
* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then each call
to `Connection.connect()` establishes an exclusive connection to a
Wherobots runtime; if set to "multi", then multiple `Connection.connect()`
calls with the same arguments and credentials will connect to the same
shared Wherobots runtime; `"single"` is the default.
to `connect()` establishes an exclusive connection to a Wherobots runtime;
if set to "multi", then multiple `connect()` calls with the same arguments
and credentials will connect to the sameshared Wherobots runtime;
`"single"` is the default.

Consider multi-session for potential cost savings, but be mindful of
performance impacts from shared resources. You might need to adjust
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "wherobots-python-dbapi"

[tool.poetry]
name = "wherobots-python-dbapi"
version = "0.12.0"
version = "0.12.1"
description = "Python DB-API driver for Wherobots DB"
authors = ["Maxime Petazzoni <max@wherobots.com>"]
license = "Apache 2.0"
Expand Down
9 changes: 8 additions & 1 deletion tests/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
from rich.table import Table

from wherobots.db import connect, connect_direct
from wherobots.db.constants import DEFAULT_ENDPOINT
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.session_type import SessionType

if __name__ == "__main__":
parser = argparse.ArgumentParser()
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(
"--session-type",
help="Type of session to create. 'single' or 'multi'",
default=DEFAULT_SESSION_TYPE,
)
parser.add_argument(
"--debug",
help="Enable debug logging",
Expand Down Expand Up @@ -76,6 +82,7 @@
shutdown_after_inactive_seconds=args.shutdown_after_inactive_seconds,
wait_timeout=900,
region=Region(args.region) if args.region else Region.AWS_US_WEST_2,
session_type=SessionType(args.session_type),
)

def render(results: pandas.DataFrame) -> None:
Expand Down
3 changes: 2 additions & 1 deletion wherobots/db/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ def connect(
try:
resp = requests.post(
url=f"{host}/sql/session",
params={"region": region.value, "sessionType": session_type.value},
params={"region": region.value},
json={
"runtimeId": runtime.value,
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
"sessionType": session_type.value,
},
headers=headers,
)
Expand Down