Skip to content

Commit a01d262

Browse files
committed
fix: move session type to request body
as part of adding the session type to the smoke test script i realized i had added it to the wrong place, it should go in the request body not as a query parameter. also some minor docs cleanup
1 parent 0b1b413 commit a01d262

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ users may find useful:
8282
convenient for human inspection while still being usable by
8383
libraries like Shapely.
8484
* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then each call
85-
to `Connection.connect()` establishes an exclusive connection to a
86-
Wherobots runtime; if set to "multi", then multiple `Connection.connect()`
87-
calls with the same arguments and credentials will connect to the same
88-
shared Wherobots runtime; `"single"` is the default.
85+
to `connect()` establishes an exclusive connection to a Wherobots runtime;
86+
if set to "multi", then multiple `connect()` calls with the same arguments
87+
and credentials will connect to the sameshared Wherobots runtime;
88+
`"single"` is the default.
8989

9090
Consider multi-session for potential cost savings, but be mindful of
9191
performance impacts from shared resources. You might need to adjust

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "wherobots-python-dbapi"
33

44
[tool.poetry]
55
name = "wherobots-python-dbapi"
6-
version = "0.12.0"
6+
version = "0.12.1"
77
description = "Python DB-API driver for Wherobots DB"
88
authors = ["Maxime Petazzoni <[email protected]>"]
99
license = "Apache 2.0"

tests/smoke.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@
1111
from rich.table import Table
1212

1313
from wherobots.db import connect, connect_direct
14-
from wherobots.db.constants import DEFAULT_ENDPOINT
14+
from wherobots.db.constants import DEFAULT_ENDPOINT, DEFAULT_SESSION_TYPE
1515
from wherobots.db.connection import Connection
1616
from wherobots.db.region import Region
17+
from wherobots.db.session_type import SessionType
1718

1819
if __name__ == "__main__":
1920
parser = argparse.ArgumentParser()
2021
parser.add_argument("--api-key-file", help="File containing the API key")
2122
parser.add_argument("--token-file", help="File containing the token")
2223
parser.add_argument("--region", help="Region to connect to (ie. aws-us-west-2)")
24+
parser.add_argument(
25+
"--session-type",
26+
help="Type of session to create. 'single' or 'multi'",
27+
default=DEFAULT_SESSION_TYPE,
28+
)
2329
parser.add_argument(
2430
"--debug",
2531
help="Enable debug logging",
@@ -76,6 +82,7 @@
7682
shutdown_after_inactive_seconds=args.shutdown_after_inactive_seconds,
7783
wait_timeout=900,
7884
region=Region(args.region) if args.region else Region.AWS_US_WEST_2,
85+
session_type=SessionType(args.session_type),
7986
)
8087

8188
def render(results: pandas.DataFrame) -> None:

wherobots/db/driver.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ def connect(
100100
try:
101101
resp = requests.post(
102102
url=f"{host}/sql/session",
103-
params={"region": region.value, "sessionType": session_type.value},
103+
params={"region": region.value},
104104
json={
105105
"runtimeId": runtime.value,
106106
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
107+
"sessionType": session_type.value,
107108
},
108109
headers=headers,
109110
)

0 commit comments

Comments
 (0)