singlestoredb 1.12.0__cp38-abi3-win32.whl → 1.12.1__cp38-abi3-win32.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 +0 -0
- singlestoredb/__init__.py +1 -1
- singlestoredb/fusion/handlers/utils.py +14 -8
- singlestoredb/management/files.py +7 -8
- singlestoredb/management/workspace.py +5 -6
- singlestoredb/tests/test_management.py +50 -2
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/METADATA +1 -1
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/RECORD +12 -12
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/LICENSE +0 -0
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/WHEEL +0 -0
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.12.0.dist-info → singlestoredb-1.12.1.dist-info}/top_level.txt +0 -0
_singlestoredb_accel.pyd
CHANGED
|
Binary file
|
singlestoredb/__init__.py
CHANGED
|
@@ -7,13 +7,11 @@ from typing import Optional
|
|
|
7
7
|
from typing import Union
|
|
8
8
|
|
|
9
9
|
from ...exceptions import ManagementError
|
|
10
|
+
from ...management import files as mgmt_files
|
|
10
11
|
from ...management import manage_workspaces
|
|
11
12
|
from ...management.files import FilesManager
|
|
12
13
|
from ...management.files import FileSpace
|
|
13
14
|
from ...management.files import manage_files
|
|
14
|
-
from ...management.files import MODELS_SPACE
|
|
15
|
-
from ...management.files import PERSONAL_SPACE
|
|
16
|
-
from ...management.files import SHARED_SPACE
|
|
17
15
|
from ...management.workspace import StarterWorkspace
|
|
18
16
|
from ...management.workspace import Workspace
|
|
19
17
|
from ...management.workspace import WorkspaceGroup
|
|
@@ -190,6 +188,10 @@ def get_deployment(
|
|
|
190
188
|
* params['group']['deployment_id']
|
|
191
189
|
* params['in_deployment']['deployment_name']
|
|
192
190
|
* params['in_deployment']['deployment_id']
|
|
191
|
+
* params['in']['in_group']['deployment_name']
|
|
192
|
+
* params['in']['in_group']['deployment_id']
|
|
193
|
+
* params['in']['in_deployment']['deployment_name']
|
|
194
|
+
* params['in']['in_deployment']['deployment_id']
|
|
193
195
|
|
|
194
196
|
Or, from the SINGLESTOREDB_WORKSPACE_GROUP
|
|
195
197
|
or SINGLESTOREDB_CLUSTER environment variables.
|
|
@@ -199,7 +201,9 @@ def get_deployment(
|
|
|
199
201
|
|
|
200
202
|
deployment_name = params.get('deployment_name') or \
|
|
201
203
|
(params.get('in_deployment') or {}).get('deployment_name') or \
|
|
202
|
-
(params.get('group') or {}).get('deployment_name')
|
|
204
|
+
(params.get('group') or {}).get('deployment_name') or \
|
|
205
|
+
((params.get('in') or {}).get('in_group') or {}).get('deployment_name') or \
|
|
206
|
+
((params.get('in') or {}).get('in_deployment') or {}).get('deployment_name')
|
|
203
207
|
if deployment_name:
|
|
204
208
|
workspace_groups = [
|
|
205
209
|
x for x in manager.workspace_groups
|
|
@@ -239,7 +243,9 @@ def get_deployment(
|
|
|
239
243
|
|
|
240
244
|
deployment_id = params.get('deployment_id') or \
|
|
241
245
|
(params.get('in_deployment') or {}).get('deployment_id') or \
|
|
242
|
-
(params.get('group') or {}).get('deployment_id')
|
|
246
|
+
(params.get('group') or {}).get('deployment_id') or \
|
|
247
|
+
((params.get('in') or {}).get('in_group') or {}).get('deployment_id') or \
|
|
248
|
+
((params.get('in') or {}).get('in_deployment') or {}).get('deployment_id')
|
|
243
249
|
if deployment_id:
|
|
244
250
|
try:
|
|
245
251
|
return manager.get_workspace_group(deployment_id)
|
|
@@ -298,11 +304,11 @@ def get_file_space(params: Dict[str, Any]) -> FileSpace:
|
|
|
298
304
|
if file_location:
|
|
299
305
|
file_location_lower_case = file_location.lower()
|
|
300
306
|
|
|
301
|
-
if file_location_lower_case == PERSONAL_SPACE:
|
|
307
|
+
if file_location_lower_case == mgmt_files.PERSONAL_SPACE:
|
|
302
308
|
return manager.personal_space
|
|
303
|
-
elif file_location_lower_case == SHARED_SPACE:
|
|
309
|
+
elif file_location_lower_case == mgmt_files.SHARED_SPACE:
|
|
304
310
|
return manager.shared_space
|
|
305
|
-
elif file_location_lower_case == MODELS_SPACE:
|
|
311
|
+
elif file_location_lower_case == mgmt_files.MODELS_SPACE:
|
|
306
312
|
return manager.models_space
|
|
307
313
|
else:
|
|
308
314
|
raise ValueError(f'invalid file location: {file_location}')
|
|
@@ -10,11 +10,9 @@ import re
|
|
|
10
10
|
from abc import ABC
|
|
11
11
|
from abc import abstractmethod
|
|
12
12
|
from typing import Any
|
|
13
|
-
from typing import BinaryIO
|
|
14
13
|
from typing import Dict
|
|
15
14
|
from typing import List
|
|
16
15
|
from typing import Optional
|
|
17
|
-
from typing import TextIO
|
|
18
16
|
from typing import Union
|
|
19
17
|
|
|
20
18
|
from .. import config
|
|
@@ -362,7 +360,7 @@ class FileLocation(ABC):
|
|
|
362
360
|
@abstractmethod
|
|
363
361
|
def upload_file(
|
|
364
362
|
self,
|
|
365
|
-
local_path: Union[PathLike,
|
|
363
|
+
local_path: Union[PathLike, io.IOBase],
|
|
366
364
|
path: PathLike,
|
|
367
365
|
*,
|
|
368
366
|
overwrite: bool = False,
|
|
@@ -385,7 +383,7 @@ class FileLocation(ABC):
|
|
|
385
383
|
@abstractmethod
|
|
386
384
|
def _upload(
|
|
387
385
|
self,
|
|
388
|
-
content: Union[str, bytes,
|
|
386
|
+
content: Union[str, bytes, io.IOBase],
|
|
389
387
|
path: PathLike,
|
|
390
388
|
*,
|
|
391
389
|
overwrite: bool = False,
|
|
@@ -628,7 +626,7 @@ class FileSpace(FileLocation):
|
|
|
628
626
|
|
|
629
627
|
def upload_file(
|
|
630
628
|
self,
|
|
631
|
-
local_path: Union[PathLike,
|
|
629
|
+
local_path: Union[PathLike, io.IOBase],
|
|
632
630
|
path: PathLike,
|
|
633
631
|
*,
|
|
634
632
|
overwrite: bool = False,
|
|
@@ -646,7 +644,7 @@ class FileSpace(FileLocation):
|
|
|
646
644
|
Should the ``path`` be overwritten if it exists already?
|
|
647
645
|
|
|
648
646
|
"""
|
|
649
|
-
if isinstance(local_path,
|
|
647
|
+
if isinstance(local_path, io.IOBase):
|
|
650
648
|
pass
|
|
651
649
|
elif not os.path.isfile(local_path):
|
|
652
650
|
raise IsADirectoryError(f'local path is not a file: {local_path}')
|
|
@@ -657,8 +655,9 @@ class FileSpace(FileLocation):
|
|
|
657
655
|
|
|
658
656
|
self.remove(path)
|
|
659
657
|
|
|
660
|
-
if isinstance(local_path,
|
|
658
|
+
if isinstance(local_path, io.IOBase):
|
|
661
659
|
return self._upload(local_path, path, overwrite=overwrite)
|
|
660
|
+
|
|
662
661
|
return self._upload(open(local_path, 'rb'), path, overwrite=overwrite)
|
|
663
662
|
|
|
664
663
|
def upload_folder(
|
|
@@ -727,7 +726,7 @@ class FileSpace(FileLocation):
|
|
|
727
726
|
|
|
728
727
|
def _upload(
|
|
729
728
|
self,
|
|
730
|
-
content: Union[str, bytes,
|
|
729
|
+
content: Union[str, bytes, io.IOBase],
|
|
731
730
|
path: PathLike,
|
|
732
731
|
*,
|
|
733
732
|
overwrite: bool = False,
|
|
@@ -10,11 +10,9 @@ import re
|
|
|
10
10
|
import time
|
|
11
11
|
from collections.abc import Mapping
|
|
12
12
|
from typing import Any
|
|
13
|
-
from typing import BinaryIO
|
|
14
13
|
from typing import Dict
|
|
15
14
|
from typing import List
|
|
16
15
|
from typing import Optional
|
|
17
|
-
from typing import TextIO
|
|
18
16
|
from typing import Union
|
|
19
17
|
|
|
20
18
|
from .. import config
|
|
@@ -165,7 +163,7 @@ class Stage(FileLocation):
|
|
|
165
163
|
|
|
166
164
|
def upload_file(
|
|
167
165
|
self,
|
|
168
|
-
local_path: Union[PathLike,
|
|
166
|
+
local_path: Union[PathLike, io.IOBase],
|
|
169
167
|
stage_path: PathLike,
|
|
170
168
|
*,
|
|
171
169
|
overwrite: bool = False,
|
|
@@ -183,7 +181,7 @@ class Stage(FileLocation):
|
|
|
183
181
|
Should the ``stage_path`` be overwritten if it exists already?
|
|
184
182
|
|
|
185
183
|
"""
|
|
186
|
-
if isinstance(local_path,
|
|
184
|
+
if isinstance(local_path, io.IOBase):
|
|
187
185
|
pass
|
|
188
186
|
elif not os.path.isfile(local_path):
|
|
189
187
|
raise IsADirectoryError(f'local path is not a file: {local_path}')
|
|
@@ -194,8 +192,9 @@ class Stage(FileLocation):
|
|
|
194
192
|
|
|
195
193
|
self.remove(stage_path)
|
|
196
194
|
|
|
197
|
-
if isinstance(local_path,
|
|
195
|
+
if isinstance(local_path, io.IOBase):
|
|
198
196
|
return self._upload(local_path, stage_path, overwrite=overwrite)
|
|
197
|
+
|
|
199
198
|
return self._upload(open(local_path, 'rb'), stage_path, overwrite=overwrite)
|
|
200
199
|
|
|
201
200
|
def upload_folder(
|
|
@@ -258,7 +257,7 @@ class Stage(FileLocation):
|
|
|
258
257
|
|
|
259
258
|
def _upload(
|
|
260
259
|
self,
|
|
261
|
-
content: Union[str, bytes,
|
|
260
|
+
content: Union[str, bytes, io.IOBase],
|
|
262
261
|
stage_path: PathLike,
|
|
263
262
|
*,
|
|
264
263
|
overwrite: bool = False,
|
|
@@ -414,8 +414,12 @@ class TestStage(unittest.TestCase):
|
|
|
414
414
|
with self.assertRaises(OSError):
|
|
415
415
|
st.upload_file(TEST_DIR / 'test.sql', 'upload_test.sql')
|
|
416
416
|
|
|
417
|
-
# Force overwrite with new content
|
|
418
|
-
f = st.upload_file(
|
|
417
|
+
# Force overwrite with new content; use file object this time
|
|
418
|
+
f = st.upload_file(
|
|
419
|
+
open(TEST_DIR / 'test2.sql', 'r'),
|
|
420
|
+
'upload_test.sql',
|
|
421
|
+
overwrite=True,
|
|
422
|
+
)
|
|
419
423
|
assert str(f.path) == 'upload_test.sql'
|
|
420
424
|
assert f.type == 'file'
|
|
421
425
|
|
|
@@ -1093,6 +1097,50 @@ class TestFileSpaces(unittest.TestCase):
|
|
|
1093
1097
|
# Cleanup
|
|
1094
1098
|
space.remove('upload_test.ipynb')
|
|
1095
1099
|
|
|
1100
|
+
def test_upload_file_io(self):
|
|
1101
|
+
for space in [self.personal_space, self.shared_space]:
|
|
1102
|
+
root = space.info('/')
|
|
1103
|
+
assert str(root.path) == '/'
|
|
1104
|
+
assert root.type == 'directory'
|
|
1105
|
+
|
|
1106
|
+
# Upload files
|
|
1107
|
+
f = space.upload_file(
|
|
1108
|
+
open(TEST_DIR / 'test.ipynb', 'r'),
|
|
1109
|
+
'upload_test.ipynb',
|
|
1110
|
+
)
|
|
1111
|
+
assert str(f.path) == 'upload_test.ipynb'
|
|
1112
|
+
assert f.type == 'notebook'
|
|
1113
|
+
|
|
1114
|
+
# Download and compare to original
|
|
1115
|
+
txt = f.download(encoding='utf-8')
|
|
1116
|
+
assert txt == open(TEST_DIR / 'test.ipynb').read()
|
|
1117
|
+
|
|
1118
|
+
# Make sure we can't overwrite
|
|
1119
|
+
with self.assertRaises(OSError):
|
|
1120
|
+
space.upload_file(
|
|
1121
|
+
open(TEST_DIR / 'test.ipynb', 'r'),
|
|
1122
|
+
'upload_test.ipynb',
|
|
1123
|
+
)
|
|
1124
|
+
|
|
1125
|
+
# Force overwrite with new content
|
|
1126
|
+
f = space.upload_file(
|
|
1127
|
+
open(TEST_DIR / 'test2.ipynb', 'r'),
|
|
1128
|
+
'upload_test.ipynb', overwrite=True,
|
|
1129
|
+
)
|
|
1130
|
+
assert str(f.path) == 'upload_test.ipynb'
|
|
1131
|
+
assert f.type == 'notebook'
|
|
1132
|
+
|
|
1133
|
+
# Verify new content
|
|
1134
|
+
txt = f.download(encoding='utf-8')
|
|
1135
|
+
assert txt == open(TEST_DIR / 'test2.ipynb').read()
|
|
1136
|
+
|
|
1137
|
+
# Make sure we can't upload a folder
|
|
1138
|
+
with self.assertRaises(s2.ManagementError):
|
|
1139
|
+
space.upload_folder(TEST_DIR, 'test')
|
|
1140
|
+
|
|
1141
|
+
# Cleanup
|
|
1142
|
+
space.remove('upload_test.ipynb')
|
|
1143
|
+
|
|
1096
1144
|
def test_open(self):
|
|
1097
1145
|
for space in [self.personal_space, self.shared_space]:
|
|
1098
1146
|
# See if error is raised for non-existent file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
_singlestoredb_accel.pyd,sha256=
|
|
2
|
-
singlestoredb/__init__.py,sha256=
|
|
1
|
+
_singlestoredb_accel.pyd,sha256=BwsfOZcfwH1-KzraPk2zr67GLoOuKfvzBv98PfiiScc,61440
|
|
2
|
+
singlestoredb/__init__.py,sha256=OPUFo7H7ruOIJ8PhqbIqFM3SLvfG3ny3REXme5oFLhc,1712
|
|
3
3
|
singlestoredb/auth.py,sha256=RmYiH0Wlc2RXc4pTlRMysxtBI445ggCIwojWKC_eDLE,7844
|
|
4
4
|
singlestoredb/config.py,sha256=5OY9RDlGBrBWAHsGrg0X4v0y_QwNb7G6FSQooMgT8rY,13032
|
|
5
5
|
singlestoredb/connection.py,sha256=Ty_idVYH50Qx-j8WXy7NeB-DYLAcpdjGYTrTHkKzG9U,47309
|
|
@@ -41,7 +41,7 @@ singlestoredb/fusion/handlers/files.py,sha256=pCx1sqnjPtQrp39rv_V4RX9CVtj6uSiL6H
|
|
|
41
41
|
singlestoredb/fusion/handlers/job.py,sha256=3enfxHwERH7T4u0FEwOPN0IL0GtepaCYgEsisiy3Df4,21753
|
|
42
42
|
singlestoredb/fusion/handlers/models.py,sha256=XWaPJQc3GQIOAcjNcxBSGUBJ3xu2qkzQ4ILa40TFQmY,6486
|
|
43
43
|
singlestoredb/fusion/handlers/stage.py,sha256=PP-SSP204lwpmnycSXXSmFPzoN535JVuwglDCbaQ8Lw,14789
|
|
44
|
-
singlestoredb/fusion/handlers/utils.py,sha256=
|
|
44
|
+
singlestoredb/fusion/handlers/utils.py,sha256=2Lhnb9GqRMhCnO_C63iKt2hU7XFsllRKvQm3ChNzlrA,10890
|
|
45
45
|
singlestoredb/fusion/handlers/workspace.py,sha256=NxoEY5xd5lCQmXiim4nhAYCL0agHo1H_rGPpqa31hiw,28397
|
|
46
46
|
singlestoredb/http/__init__.py,sha256=4cEDvLloGc3LSpU-PnIwacyu0n5oIIIE6xk2SPyWD_w,939
|
|
47
47
|
singlestoredb/http/connection.py,sha256=dqXX5SSn6EOV7q0Ehh0E525eLT__B_jJLG-7jgVjbXg,40861
|
|
@@ -52,13 +52,13 @@ singlestoredb/management/__init__.py,sha256=A66ZnFyX--PsAZ2tvtYUfIUBvVGDBFQsnVc6
|
|
|
52
52
|
singlestoredb/management/billing_usage.py,sha256=0UHFSPCrN0nyeGFFM-HXS3NP8pYmYo2BCCahDEPXvzg,3883
|
|
53
53
|
singlestoredb/management/cluster.py,sha256=auBzNYIXvnI6rq3DNpPgJhwWoT6JsyZRikjpON23Pxg,14867
|
|
54
54
|
singlestoredb/management/export.py,sha256=2dCvnTnkxVI-arX3_375DtWzHkI1YNK5zaFYdHKE4cs,5277
|
|
55
|
-
singlestoredb/management/files.py,sha256=
|
|
55
|
+
singlestoredb/management/files.py,sha256=rDXWmxVC-rx_ghHrCkdHyeBGGy6lb73wLWO6VkxdqMQ,31577
|
|
56
56
|
singlestoredb/management/job.py,sha256=Npfe1JLYJlggGBrXLniPKwKUKF1i3alvSY1SFtvauSs,25498
|
|
57
57
|
singlestoredb/management/manager.py,sha256=8zU0d7NG83PYMhoAs2JriTqbqh-R2tLX7VZoeZtcogY,9148
|
|
58
58
|
singlestoredb/management/organization.py,sha256=JBsNC4R3boUKdYvyCZyfGoVMC1mD6SPuMI1UssBVoOM,5611
|
|
59
59
|
singlestoredb/management/region.py,sha256=oGoLLS88dE1GmY7GCc0BV7X3f7bWwKQyeXOVBFmK9Pk,1678
|
|
60
60
|
singlestoredb/management/utils.py,sha256=BP-Wb8Sg16GbdLI_DeBz-3ttMklz6ZjYyMOz-sxElz8,13594
|
|
61
|
-
singlestoredb/management/workspace.py,sha256=
|
|
61
|
+
singlestoredb/management/workspace.py,sha256=D9DzpeWU7xFjpj8bBYiXyasjVYVANeYjTzgkz2aKvJQ,57984
|
|
62
62
|
singlestoredb/mysql/__init__.py,sha256=CbpwzNUJPAmKPpIobC0-ugBta_RgHCMq7X7N75QLReY,4669
|
|
63
63
|
singlestoredb/mysql/_auth.py,sha256=YaqqyvAHmeraBv3BM207rNveUVPM-mPnW20ts_ynVWg,8341
|
|
64
64
|
singlestoredb/mysql/charset.py,sha256=mnCdMpvdub1S2mm2PSk2j5JddgsWRjsVLtGx-y9TskE,10724
|
|
@@ -122,7 +122,7 @@ singlestoredb/tests/test_ext_func.py,sha256=gQErR-wAN8BqLNG5U4pNbg4qkQEo6Re8Hd9_
|
|
|
122
122
|
singlestoredb/tests/test_ext_func_data.py,sha256=9kn8BWmCjkbnP6hSbFhmhcdW4OmVT-GSvBTIzFBLEys,48796
|
|
123
123
|
singlestoredb/tests/test_fusion.py,sha256=ckATjXKcDBvej68PZgTRJirdoywtUJ7WXkZmfR0la_4,24544
|
|
124
124
|
singlestoredb/tests/test_http.py,sha256=7hwXe61hlUes3nji0MTTZweo94tJAlJ-vA5ct9geXFQ,8868
|
|
125
|
-
singlestoredb/tests/test_management.py,sha256=
|
|
125
|
+
singlestoredb/tests/test_management.py,sha256=EJY-JDFNS83_pM0KKJlEHoRiEZWHxjK2XWtM0YAy63U,46462
|
|
126
126
|
singlestoredb/tests/test_plugin.py,sha256=P1nXLnTafaHkHN-6bVbGryxTu7OWJPU9SYFZ_WQUwq8,845
|
|
127
127
|
singlestoredb/tests/test_results.py,sha256=Zg1ynZFRZqalAMfNLOU5C6BDXaox6JxrKm_XZwVNFcg,6753
|
|
128
128
|
singlestoredb/tests/test_types.py,sha256=YeVE6KPqlqzJke-4hbRmc8ko1E7RLHu5S8qLg04Bl5Y,4632
|
|
@@ -141,9 +141,9 @@ singlestoredb/utils/results.py,sha256=wR70LhCqlobniZf52r67zYLBOKjWHQm68NAskdRQND
|
|
|
141
141
|
singlestoredb/utils/xdict.py,sha256=-wi1lSPTnY99fhVMBhPKJ8cCsQhNG4GMUfkEBDKYgCw,13321
|
|
142
142
|
sqlx/__init__.py,sha256=4Sdn8HN-Hf8v0_wCt60DCckCg8BvgM3-9r4YVfZycRE,89
|
|
143
143
|
sqlx/magic.py,sha256=6VBlotgjautjev599tHaTYOfcfOA9m6gV_-P1_Qc4lI,3622
|
|
144
|
-
singlestoredb-1.12.
|
|
145
|
-
singlestoredb-1.12.
|
|
146
|
-
singlestoredb-1.12.
|
|
147
|
-
singlestoredb-1.12.
|
|
148
|
-
singlestoredb-1.12.
|
|
149
|
-
singlestoredb-1.12.
|
|
144
|
+
singlestoredb-1.12.1.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
|
|
145
|
+
singlestoredb-1.12.1.dist-info/METADATA,sha256=Va-hWQVTc0rFk4y48dBNEVNd1zyFcG_0MkbkrBQ8LQE,5778
|
|
146
|
+
singlestoredb-1.12.1.dist-info/WHEEL,sha256=c4k7z5HB0t-y0nBCv6KyJ6KCjn8SEGPddD0lhaPtU3E,96
|
|
147
|
+
singlestoredb-1.12.1.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
|
|
148
|
+
singlestoredb-1.12.1.dist-info/top_level.txt,sha256=lA65Vf4qAMfg_s1oG3LEO90h4t1Z-SPDbRqkevI3bSY,40
|
|
149
|
+
singlestoredb-1.12.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|