wherobots-python-dbapi 0.7.4__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/PKG-INFO +5 -2
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/README.md +4 -1
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/pyproject.toml +1 -1
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/constants.py +4 -1
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/driver.py +5 -5
- wherobots_python_dbapi-0.8.0/wherobots/db/runtime.py +42 -0
- wherobots_python_dbapi-0.7.4/wherobots/db/runtime.py +0 -21
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/LICENSE +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/__init__.py +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/__init__.py +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/connection.py +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/cursor.py +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/errors.py +0 -0
- {wherobots_python_dbapi-0.7.4 → wherobots_python_dbapi-0.8.0}/wherobots/db/region.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wherobots-python-dbapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Python DB-API driver for Wherobots DB
|
|
5
5
|
License: Apache 2.0
|
|
6
6
|
Author: Maxime Petazzoni
|
|
@@ -57,7 +57,7 @@ from wherobots.db.runtime import Runtime
|
|
|
57
57
|
|
|
58
58
|
with connect(
|
|
59
59
|
api_key='...',
|
|
60
|
-
runtime=Runtime.
|
|
60
|
+
runtime=Runtime.TINY,
|
|
61
61
|
region=Region.AWS_US_WEST_2) as conn:
|
|
62
62
|
curr = conn.cursor()
|
|
63
63
|
curr.execute("SHOW SCHEMAS IN wherobots_open_data")
|
|
@@ -105,4 +105,7 @@ users may find useful:
|
|
|
105
105
|
client application. The default is EWKT (string) and the most
|
|
106
106
|
convenient for human inspection while still being usable by
|
|
107
107
|
libraries like Shapely.
|
|
108
|
+
* `reuse_session`: controls whether an existing runtime of the same type
|
|
109
|
+
and in the same region that is available should be re-used for this
|
|
110
|
+
connection. This is the default behavior.
|
|
108
111
|
|
|
@@ -33,7 +33,7 @@ from wherobots.db.runtime import Runtime
|
|
|
33
33
|
|
|
34
34
|
with connect(
|
|
35
35
|
api_key='...',
|
|
36
|
-
runtime=Runtime.
|
|
36
|
+
runtime=Runtime.TINY,
|
|
37
37
|
region=Region.AWS_US_WEST_2) as conn:
|
|
38
38
|
curr = conn.cursor()
|
|
39
39
|
curr.execute("SHOW SCHEMAS IN wherobots_open_data")
|
|
@@ -81,3 +81,6 @@ users may find useful:
|
|
|
81
81
|
client application. The default is EWKT (string) and the most
|
|
82
82
|
convenient for human inspection while still being usable by
|
|
83
83
|
libraries like Shapely.
|
|
84
|
+
* `reuse_session`: controls whether an existing runtime of the same type
|
|
85
|
+
and in the same region that is available should be re-used for this
|
|
86
|
+
connection. This is the default behavior.
|
|
@@ -7,10 +7,13 @@ from .runtime import Runtime
|
|
|
7
7
|
|
|
8
8
|
DEFAULT_ENDPOINT: str = "api.cloud.wherobots.com" # "api.cloud.wherobots.com"
|
|
9
9
|
STAGING_ENDPOINT: str = "api.staging.wherobots.com" # "api.staging.wherobots.com"
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
DEFAULT_RUNTIME: Runtime = Runtime.TINY
|
|
11
12
|
DEFAULT_REGION: Region = Region.AWS_US_WEST_2
|
|
12
13
|
DEFAULT_READ_TIMEOUT_SECONDS: float = 0.25
|
|
13
14
|
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS: float = 900
|
|
15
|
+
DEFAULT_REUSE_SESSION: bool = True
|
|
16
|
+
|
|
14
17
|
MAX_MESSAGE_SIZE: int = 100 * 2**20 # 100MiB
|
|
15
18
|
PROTOCOL_VERSION: str = "1.0.0"
|
|
16
19
|
|
|
@@ -19,6 +19,7 @@ import websockets.sync.client
|
|
|
19
19
|
from .constants import (
|
|
20
20
|
DEFAULT_ENDPOINT,
|
|
21
21
|
DEFAULT_REGION,
|
|
22
|
+
DEFAULT_REUSE_SESSION,
|
|
22
23
|
DEFAULT_RUNTIME,
|
|
23
24
|
DEFAULT_READ_TIMEOUT_SECONDS,
|
|
24
25
|
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
|
|
@@ -62,6 +63,7 @@ def connect(
|
|
|
62
63
|
region: Region = None,
|
|
63
64
|
wait_timeout: float = DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
|
|
64
65
|
read_timeout: float = DEFAULT_READ_TIMEOUT_SECONDS,
|
|
66
|
+
reuse_session: bool = DEFAULT_REUSE_SESSION,
|
|
65
67
|
shutdown_after_inactive_seconds: Union[int, None] = None,
|
|
66
68
|
results_format: Union[ResultsFormat, None] = None,
|
|
67
69
|
data_compression: Union[DataCompression, None] = None,
|
|
@@ -78,15 +80,13 @@ def connect(
|
|
|
78
80
|
elif api_key:
|
|
79
81
|
headers["X-API-Key"] = api_key
|
|
80
82
|
|
|
81
|
-
logging.info(headers)
|
|
82
|
-
|
|
83
83
|
host = host or DEFAULT_ENDPOINT
|
|
84
84
|
runtime = runtime or DEFAULT_RUNTIME
|
|
85
85
|
region = region or DEFAULT_REGION
|
|
86
86
|
|
|
87
87
|
logging.info(
|
|
88
|
-
"
|
|
89
|
-
|
|
88
|
+
"%s %s runtime in %s from %s ...",
|
|
89
|
+
"Recycling" if reuse_session else "Requesting",
|
|
90
90
|
runtime.value,
|
|
91
91
|
region.value,
|
|
92
92
|
host,
|
|
@@ -99,7 +99,7 @@ def connect(
|
|
|
99
99
|
try:
|
|
100
100
|
resp = requests.post(
|
|
101
101
|
url=f"{host}/sql/session",
|
|
102
|
-
params={"region": region.value},
|
|
102
|
+
params={"region": region.value, "reuse_session": reuse_session},
|
|
103
103
|
json={
|
|
104
104
|
"runtimeId": runtime.value,
|
|
105
105
|
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Runtime(Enum):
|
|
5
|
+
TINY = "tiny"
|
|
6
|
+
SMALL = "small"
|
|
7
|
+
MEDIUM = "medium"
|
|
8
|
+
LARGE = "large"
|
|
9
|
+
X_LARGE = "x-large"
|
|
10
|
+
XX_LARGE = "2x-large"
|
|
11
|
+
XXXX_LARGE = "4x-large"
|
|
12
|
+
|
|
13
|
+
# HIMEM
|
|
14
|
+
MEDIUM_HIMEM = "medium-himem"
|
|
15
|
+
LARGE_HIMEM = "large-himem"
|
|
16
|
+
X_LARGE_HIMEM = "x-large-himem"
|
|
17
|
+
XX_LARGE_HIMEM = "2x-large-himem"
|
|
18
|
+
XXXX_LARGE_HIMEM = "4x-large-himem"
|
|
19
|
+
|
|
20
|
+
# GPU
|
|
21
|
+
TINY_A10_GPU = "tiny-a10-gpu"
|
|
22
|
+
SMALL_A10_GPU = "small-a10-gpu"
|
|
23
|
+
MEDIUM_A10_GPU = "medium-a10-gpu"
|
|
24
|
+
|
|
25
|
+
# Deprecated names; will be removed in a later major version.
|
|
26
|
+
SEDONA = "tiny"
|
|
27
|
+
SAN_FRANCISCO = "small"
|
|
28
|
+
NEW_YORK = "medium"
|
|
29
|
+
CAIRO = "large"
|
|
30
|
+
DELHI = "x-large"
|
|
31
|
+
TOKYO = "2x-large"
|
|
32
|
+
ATLANTIS = "4x-large"
|
|
33
|
+
|
|
34
|
+
NEW_YORK_HIMEM = "medium-himem"
|
|
35
|
+
CAIRO_HIMEM = "large-himem"
|
|
36
|
+
DELHI_HIMEM = "x-large-himem"
|
|
37
|
+
TOKYO_HIMEM = "2x-large-himem"
|
|
38
|
+
ATLANTIS_HIMEM = "4x-large-himem"
|
|
39
|
+
|
|
40
|
+
SEDONA_GPU = "tiny-a10-gpu"
|
|
41
|
+
SAN_FRANCISCO_GPU = "small-a10-gpu"
|
|
42
|
+
NEW_YORK_GPU = "medium-a10-gpu"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class Runtime(Enum):
|
|
5
|
-
SEDONA = "tiny"
|
|
6
|
-
SAN_FRANCISCO = "small"
|
|
7
|
-
NEW_YORK = "medium"
|
|
8
|
-
CAIRO = "large"
|
|
9
|
-
DELHI = "x-large"
|
|
10
|
-
TOKYO = "2x-large"
|
|
11
|
-
ATLANTIS = "4x-large"
|
|
12
|
-
|
|
13
|
-
NEW_YORK_HIMEM = "medium-himem"
|
|
14
|
-
CAIRO_HIMEM = "large-himem"
|
|
15
|
-
DELHI_HIMEM = "x-large-himem"
|
|
16
|
-
TOKYO_HIMEM = "2x-large-himem"
|
|
17
|
-
ATLANTIS_HIMEM = "4x-large-himem"
|
|
18
|
-
|
|
19
|
-
SEDONA_GPU = "tiny-a10-gpu"
|
|
20
|
-
SAN_FRANCISCO_GPU = "small-a10-gpu"
|
|
21
|
-
NEW_YORK_GPU = "medium-a10-gpu"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|