wherobots-python-dbapi 0.25.4__tar.gz → 0.26.1__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.
Files changed (17) hide show
  1. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/PKG-INFO +2 -1
  2. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/README.md +1 -0
  3. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/pyproject.toml +1 -1
  4. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/driver.py +21 -4
  5. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/region.py +1 -0
  6. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/.gitignore +0 -0
  7. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/LICENSE +0 -0
  8. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/__init__.py +0 -0
  9. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/__init__.py +0 -0
  10. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/connection.py +0 -0
  11. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/constants.py +0 -0
  12. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/cursor.py +0 -0
  13. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/errors.py +0 -0
  14. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/models.py +0 -0
  15. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/runtime.py +0 -0
  16. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/session_type.py +0 -0
  17. {wherobots_python_dbapi-0.25.4 → wherobots_python_dbapi-0.26.1}/wherobots/db/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wherobots-python-dbapi
3
- Version: 0.25.4
3
+ Version: 0.26.1
4
4
  Summary: Python DB-API driver for Wherobots DB
5
5
  Project-URL: Homepage, https://github.com/wherobots/wherobots-python-dbapi-driver
6
6
  Project-URL: Tracker, https://github.com/wherobots/wherobots-python-dbapi-driver/issues
@@ -225,6 +225,7 @@ You must also specify in which region your SQL session should execute
225
225
  into. Wherobots Cloud supports the following compute regions:
226
226
 
227
227
  * `aws-us-east-1`: AWS US East 1 (N. Virginia)
228
+ * `aws-us-east-2`: AWS US East 2 (Ohio)
228
229
  * `aws-us-west-2`: AWS US West 2 (Oregon)
229
230
  * `aws-eu-west-1`: AWS EU West 1 (Ireland)
230
231
  * `aws-ap-south-1`: AWS AP South 1 (Mumbai)
@@ -201,6 +201,7 @@ You must also specify in which region your SQL session should execute
201
201
  into. Wherobots Cloud supports the following compute regions:
202
202
 
203
203
  * `aws-us-east-1`: AWS US East 1 (N. Virginia)
204
+ * `aws-us-east-2`: AWS US East 2 (Ohio)
204
205
  * `aws-us-west-2`: AWS US West 2 (Oregon)
205
206
  * `aws-eu-west-1`: AWS EU West 1 (Ireland)
206
207
  * `aws-ap-south-1`: AWS AP South 1 (Mumbai)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "wherobots-python-dbapi"
3
- version = "0.25.4"
3
+ version = "0.26.1"
4
4
  description = "Python DB-API driver for Wherobots DB"
5
5
  authors = [{ name = "Maxime Petazzoni", email = "max@wherobots.com" }]
6
6
  requires-python = ">=3.10, <4"
@@ -13,6 +13,7 @@ import requests
13
13
  import tenacity
14
14
  from typing import Final, Union, Dict
15
15
  import urllib.parse
16
+ import websockets.exceptions
16
17
  import websockets.sync.client
17
18
  import certifi
18
19
 
@@ -200,17 +201,33 @@ def connect_direct(
200
201
  geometry_representation: Union[GeometryRepresentation, None] = None,
201
202
  ) -> Connection:
202
203
  uri_with_protocol = f"{uri}/{protocol}"
204
+ ssl_context = ssl.create_default_context()
205
+ ssl_context.load_verify_locations(certifi.where())
203
206
 
204
- try:
207
+ @tenacity.retry(
208
+ stop=tenacity.stop_after_attempt(5),
209
+ wait=tenacity.wait_exponential(multiplier=1, min=1, max=5),
210
+ retry=tenacity.retry_if_exception_type(
211
+ (
212
+ ConnectionRefusedError,
213
+ ConnectionResetError,
214
+ TimeoutError,
215
+ websockets.exceptions.InvalidHandshake,
216
+ )
217
+ ),
218
+ reraise=True,
219
+ )
220
+ def ws_connect() -> websockets.sync.client.ClientConnection:
205
221
  logging.info("Connecting to SQL session at %s ...", uri_with_protocol)
206
- ssl_context = ssl.create_default_context()
207
- ssl_context.load_verify_locations(certifi.where())
208
- ws = websockets.sync.client.connect(
222
+ return websockets.sync.client.connect(
209
223
  uri=uri_with_protocol,
210
224
  additional_headers=headers,
211
225
  max_size=MAX_MESSAGE_SIZE,
212
226
  ssl=ssl_context,
213
227
  )
228
+
229
+ try:
230
+ ws = ws_connect()
214
231
  except Exception as e:
215
232
  raise InterfaceError("Failed to connect to SQL session!") from e
216
233
 
@@ -4,6 +4,7 @@ from enum import Enum
4
4
  class Region(Enum):
5
5
  # Americas
6
6
  AWS_US_EAST_1 = "aws-us-east-1"
7
+ AWS_US_EAST_2 = "aws-us-east-2"
7
8
  AWS_US_WEST_2 = "aws-us-west-2"
8
9
 
9
10
  # EMEA