singlestoredb 1.0.1__cp38-abi3-win_amd64.whl → 1.0.2__cp38-abi3-win_amd64.whl

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.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

_singlestoredb_accel.pyd CHANGED
Binary file
singlestoredb/__init__.py CHANGED
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.0.1'
16
+ __version__ = '1.0.2'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -18,7 +18,7 @@ An example of starting a server is shown below.
18
18
 
19
19
  Example
20
20
  -------
21
- $ SINGLESTOREDB_EXT_FUNCTIONS='myfuncs.[percentage_90,percentage_95]' \
21
+ $ SINGLESTOREDB_EXT_FUNCTIONS='myfuncs.[percentile_90,percentile_95]' \
22
22
  uvicorn --factory singlestoredb.functions.ext:create_app
23
23
 
24
24
  '''
@@ -2,4 +2,5 @@
2
2
  from .cluster import manage_cluster
3
3
  from .manager import get_organization
4
4
  from .manager import get_token
5
+ from .workspace import get_secret
5
6
  from .workspace import manage_workspaces
@@ -57,14 +57,15 @@ class Manager(object):
57
57
  base_url: Optional[str] = None, *, organization_id: Optional[str] = None,
58
58
  ):
59
59
  from .. import __version__ as client_version
60
- access_token = (
60
+ new_access_token = (
61
61
  access_token or get_token()
62
62
  )
63
- if not access_token:
63
+ if not new_access_token:
64
64
  raise ManagementError(msg='No management token was configured.')
65
+ self._is_jwt = not access_token and new_access_token and is_jwt(new_access_token)
65
66
  self._sess = requests.Session()
66
67
  self._sess.headers.update({
67
- 'Authorization': f'Bearer {access_token}',
68
+ 'Authorization': f'Bearer {new_access_token}',
68
69
  'Content-Type': 'application/json',
69
70
  'Accept': 'application/json',
70
71
  'User-Agent': f'SingleStoreDB-Python/{client_version}',
@@ -116,6 +117,9 @@ class Manager(object):
116
117
  **kwargs: Any,
117
118
  ) -> requests.Response:
118
119
  """Perform HTTP request."""
120
+ # Refresh the JWT as needed
121
+ if self._is_jwt:
122
+ self._sess.headers.update({'Authorization': f'Bearer {get_token()}'})
119
123
  return getattr(self._sess, method.lower())(
120
124
  urljoin(self._base_url, path), *args, **kwargs,
121
125
  )
@@ -7,6 +7,7 @@ import glob
7
7
  import io
8
8
  import os
9
9
  import re
10
+ import socket
10
11
  import time
11
12
  from typing import Any
12
13
  from typing import BinaryIO
@@ -31,6 +32,11 @@ from .utils import ttl_property
31
32
  from .utils import vars_to_str
32
33
 
33
34
 
35
+ def get_secret(name: str) -> str:
36
+ """Get a secret from the organization."""
37
+ return manage_workspaces().organization.get_secret(name).value
38
+
39
+
34
40
  class StageObject(object):
35
41
  """
36
42
  Stage file / folder object.
@@ -1334,7 +1340,7 @@ class WorkspaceGroup(object):
1334
1340
  def create_workspace(
1335
1341
  self, name: str, size: Optional[str] = None,
1336
1342
  wait_on_active: bool = False, wait_interval: int = 10,
1337
- wait_timeout: int = 600,
1343
+ wait_timeout: int = 600, add_endpoint_to_firewall_ranges: bool = True,
1338
1344
  ) -> Workspace:
1339
1345
  """
1340
1346
  Create a new workspace.
@@ -1352,6 +1358,9 @@ class WorkspaceGroup(object):
1352
1358
  if wait=True
1353
1359
  wait_interval : int, optional
1354
1360
  Number of seconds between each polling interval
1361
+ add_endpoint_to_firewall_ranges : bool, optional
1362
+ Should the workspace endpoint be added to the workspace group
1363
+ firewall ranges?
1355
1364
 
1356
1365
  Returns
1357
1366
  -------
@@ -1362,11 +1371,18 @@ class WorkspaceGroup(object):
1362
1371
  raise ManagementError(
1363
1372
  msg='No workspace manager is associated with this object.',
1364
1373
  )
1365
- return self._manager.create_workspace(
1374
+
1375
+ out = self._manager.create_workspace(
1366
1376
  name=name, workspace_group=self, size=size, wait_on_active=wait_on_active,
1367
1377
  wait_interval=wait_interval, wait_timeout=wait_timeout,
1368
1378
  )
1369
1379
 
1380
+ if add_endpoint_to_firewall_ranges and out.endpoint is not None:
1381
+ ip_address = '{}/32'.format(socket.gethostbyname(out.endpoint))
1382
+ self.update(firewall_ranges=self.firewall_ranges+[ip_address])
1383
+
1384
+ return out
1385
+
1370
1386
  @property
1371
1387
  def workspaces(self) -> NamedList[Workspace]:
1372
1388
  """Return a list of available workspaces."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -1,5 +1,5 @@
1
- _singlestoredb_accel.pyd,sha256=Bw78h2Wr9jGrGf6WvCak-kzFzCwVrqeoFl3GneP6cIw,56832
2
- singlestoredb/__init__.py,sha256=gnTnujHQYcpgy3WHCVWTdBGLRZuNfeCBSaooiorLWY0,1697
1
+ _singlestoredb_accel.pyd,sha256=TvXWAA_xqnLgJC73ZMDLnVu92inM92_lXgdTBwuntIg,56832
2
+ singlestoredb/__init__.py,sha256=QUULd5Cdoh9hxuxYZXVAss5PoWN6LFGnPhwtnhQt51o,1697
3
3
  singlestoredb/auth.py,sha256=RmYiH0Wlc2RXc4pTlRMysxtBI445ggCIwojWKC_eDLE,7844
4
4
  singlestoredb/config.py,sha256=Uq7LWKlIwMAJC3_G3j5dUIQVJf2JzbDVtRK6votjuDw,7746
5
5
  singlestoredb/connection.py,sha256=gSKmMN1d_ZSXVTmzfuHK3BXcLyNGiaSi2Vy6z7nymjg,45657
@@ -14,7 +14,7 @@ singlestoredb/functions/dtypes.py,sha256=gwDokEe7P8gvvld158CWoCKsb6Sv-77FzeKXMQi
14
14
  singlestoredb/functions/signature.py,sha256=5RGRspj_au0YJfRFeUjRmQMFzvg3a0RCpMb_uA1Poi8,20025
15
15
  singlestoredb/functions/ext/__init__.py,sha256=NrwbyL86NeG_Kv1N23R4VwL1Ap-pY9Z1By6vnKzyZBE,68
16
16
  singlestoredb/functions/ext/arrow.py,sha256=mQhwaMpvCH_dP92WIhP_j-stu272n4UAHsFUOBTgnq0,9436
17
- singlestoredb/functions/ext/asgi.py,sha256=awkfdtlMnJzomcssmacUFtrhCIzMZH5WkC7pxMxNF8M,19494
17
+ singlestoredb/functions/ext/asgi.py,sha256=n5c6U7yWyu23Cgkm8pGJyY9FJ2JRp_sih7zl932wLgU,19494
18
18
  singlestoredb/functions/ext/json.py,sha256=h0n4BZCbOWUM2le6wiysZR16bku_xgOMGmjN4Qx3Hw4,10799
19
19
  singlestoredb/functions/ext/rowdat_1.py,sha256=24mNX-1Z-ala6QwSj4_WPNk4oxbruRtCBXZoFIYqUt8,23018
20
20
  singlestoredb/fusion/__init__.py,sha256=FHWtrg6OJFTf6Ye197V5sU6ssryr2h6FBcDIgXP7-H4,367
@@ -28,14 +28,14 @@ singlestoredb/fusion/handlers/utils.py,sha256=7xWb_1mJzxW0po9iHVY2ZVnRvHIQgOlKZQ
28
28
  singlestoredb/fusion/handlers/workspace.py,sha256=ulxyFFLVpam83fPHI87Bwqc2V6AoGGHM-W8en3xq75s,11754
29
29
  singlestoredb/http/__init__.py,sha256=4cEDvLloGc3LSpU-PnIwacyu0n5oIIIE6xk2SPyWD_w,939
30
30
  singlestoredb/http/connection.py,sha256=8JO08meeJFHtTEqFSb_ju3dCVPLL8jQ4CLESeJ-JRyw,38602
31
- singlestoredb/management/__init__.py,sha256=kdKM-wErALWaEHYBLx_raHkJ8xUvUPflhOk8OBJyn58,173
31
+ singlestoredb/management/__init__.py,sha256=1xAck9ehp2aGsDMAk5paS1Ek1EdjkDlpG1GqMJwm7h0,208
32
32
  singlestoredb/management/billing_usage.py,sha256=0UHFSPCrN0nyeGFFM-HXS3NP8pYmYo2BCCahDEPXvzg,3883
33
33
  singlestoredb/management/cluster.py,sha256=0GhpuSt_rcFz5f1hzcRHK911KWFewljlV4GFtckB8uM,14822
34
- singlestoredb/management/manager.py,sha256=w9QVuj-zn5ubLOLx36bsW-Ok6KFzZRMU8ElG6hEJY9k,8812
34
+ singlestoredb/management/manager.py,sha256=_IDqeixakf5tlYRr1Nfsp2a7yU7_8K-YRq3IpMr_ewk,9061
35
35
  singlestoredb/management/organization.py,sha256=EywczC4uU1i70x_OkSqKnP6V_9D-ZuHBlETCogvJk_8,5104
36
36
  singlestoredb/management/region.py,sha256=oGoLLS88dE1GmY7GCc0BV7X3f7bWwKQyeXOVBFmK9Pk,1678
37
37
  singlestoredb/management/utils.py,sha256=Q9GXxbbSbYYFLHeCI9LSR1FqZarSAMvVdrMxq3JfjeQ,8613
38
- singlestoredb/management/workspace.py,sha256=Dnxk19hdKwd8SPO9Bf50fVnr-DQMW4AwvATpQEcTqkw,52966
38
+ singlestoredb/management/workspace.py,sha256=1ymFz45UH5VtkTgVO9bEtzf9UeWxQawUSQILumxMXXc,53596
39
39
  singlestoredb/mysql/__init__.py,sha256=CbpwzNUJPAmKPpIobC0-ugBta_RgHCMq7X7N75QLReY,4669
40
40
  singlestoredb/mysql/_auth.py,sha256=YaqqyvAHmeraBv3BM207rNveUVPM-mPnW20ts_ynVWg,8341
41
41
  singlestoredb/mysql/charset.py,sha256=mnCdMpvdub1S2mm2PSk2j5JddgsWRjsVLtGx-y9TskE,10724
@@ -104,9 +104,9 @@ singlestoredb/utils/debug.py,sha256=y7dnJeJGt3U_BWXz9pLt1qNQREpPtumYX_sk1DiqG6Y,
104
104
  singlestoredb/utils/mogrify.py,sha256=gCcn99-vgsGVjTUV7RHJ6hH4vCNrsGB_Xo4z8kiSPDQ,4201
105
105
  singlestoredb/utils/results.py,sha256=ely2XVAHHejObjLibS3UcrPOuCO2g5aRtA3PxAMtE-g,5432
106
106
  singlestoredb/utils/xdict.py,sha256=-wi1lSPTnY99fhVMBhPKJ8cCsQhNG4GMUfkEBDKYgCw,13321
107
- singlestoredb-1.0.1.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
108
- singlestoredb-1.0.1.dist-info/METADATA,sha256=9c4y611NWsrMV-dU8ZHKCzxNU0vQjdb0HwvuE-Zgllg,5654
109
- singlestoredb-1.0.1.dist-info/WHEEL,sha256=UyMHzmWA0xVqVPKfTiLs2eN3OWWZUl-kQemNbpIqlKo,100
110
- singlestoredb-1.0.1.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
111
- singlestoredb-1.0.1.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
112
- singlestoredb-1.0.1.dist-info/RECORD,,
107
+ singlestoredb-1.0.2.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
108
+ singlestoredb-1.0.2.dist-info/METADATA,sha256=f8iyBg2HQwK1qbaBzuDwmz76OikJXJ0DFEE0ayz6qlY,5654
109
+ singlestoredb-1.0.2.dist-info/WHEEL,sha256=UyMHzmWA0xVqVPKfTiLs2eN3OWWZUl-kQemNbpIqlKo,100
110
+ singlestoredb-1.0.2.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
111
+ singlestoredb-1.0.2.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
112
+ singlestoredb-1.0.2.dist-info/RECORD,,