singlestoredb 1.1.0__py3-none-any.whl → 1.3.0__py3-none-any.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/__init__.py +1 -1
- singlestoredb/config.py +6 -0
- singlestoredb/connection.py +23 -1
- singlestoredb/converters.py +390 -0
- singlestoredb/functions/ext/asgi.py +7 -1
- singlestoredb/fusion/handler.py +14 -8
- singlestoredb/fusion/handlers/stage.py +167 -84
- singlestoredb/fusion/handlers/workspace.py +250 -108
- singlestoredb/fusion/registry.py +27 -10
- singlestoredb/http/connection.py +18 -1
- singlestoredb/management/__init__.py +1 -0
- singlestoredb/management/organization.py +4 -0
- singlestoredb/management/utils.py +2 -2
- singlestoredb/management/workspace.py +79 -6
- singlestoredb/mysql/connection.py +92 -16
- singlestoredb/mysql/constants/EXTENDED_TYPE.py +3 -0
- singlestoredb/mysql/constants/FIELD_TYPE.py +16 -0
- singlestoredb/mysql/constants/VECTOR_TYPE.py +6 -0
- singlestoredb/mysql/cursors.py +13 -10
- singlestoredb/mysql/protocol.py +50 -1
- singlestoredb/notebook/__init__.py +15 -0
- singlestoredb/notebook/_objects.py +212 -0
- singlestoredb/tests/test.sql +49 -0
- singlestoredb/tests/test_connection.py +174 -0
- singlestoredb/utils/results.py +5 -1
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/METADATA +1 -1
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/RECORD +31 -27
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/LICENSE +0 -0
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/WHEEL +0 -0
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.1.0.dist-info → singlestoredb-1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -15,21 +15,32 @@ from .utils import get_workspace_manager
|
|
|
15
15
|
|
|
16
16
|
class ShowRegionsHandler(SQLHandler):
|
|
17
17
|
"""
|
|
18
|
-
SHOW REGIONS [ <like> ]
|
|
18
|
+
SHOW REGIONS [ <like> ]
|
|
19
|
+
[ <order-by> ]
|
|
20
|
+
[ <limit> ];
|
|
19
21
|
|
|
20
22
|
Description
|
|
21
23
|
-----------
|
|
22
|
-
|
|
24
|
+
Returns a list of all the valid regions for the user.
|
|
25
|
+
|
|
26
|
+
Arguments
|
|
27
|
+
---------
|
|
28
|
+
* ``<pattern>``: A pattern similar to SQL LIKE clause.
|
|
29
|
+
Uses ``%`` as the wildcard character.
|
|
23
30
|
|
|
24
31
|
Remarks
|
|
25
32
|
-------
|
|
26
|
-
* ``LIKE``
|
|
27
|
-
|
|
28
|
-
* ``LIMIT``
|
|
33
|
+
* Use the ``LIKE`` clause to specify a pattern and return only the
|
|
34
|
+
regions that match the specified pattern.
|
|
35
|
+
* The ``LIMIT`` clause limits the number of results to the
|
|
36
|
+
specified number.
|
|
37
|
+
* Use the ``ORDER BY`` clause to sort the results by the specified
|
|
38
|
+
key. By default, the results are sorted in the ascending order.
|
|
29
39
|
|
|
30
40
|
Example
|
|
31
41
|
-------
|
|
32
|
-
|
|
42
|
+
The following command returns a list of all the regions in the US
|
|
43
|
+
and sorts the results in ascending order by their ``Name``::
|
|
33
44
|
|
|
34
45
|
SHOW REGIONS LIKE 'US%' ORDER BY Name;
|
|
35
46
|
|
|
@@ -56,29 +67,40 @@ ShowRegionsHandler.register(overwrite=True)
|
|
|
56
67
|
|
|
57
68
|
class ShowWorkspaceGroupsHandler(SQLHandler):
|
|
58
69
|
"""
|
|
59
|
-
SHOW WORKSPACE GROUPS [ <like> ]
|
|
70
|
+
SHOW WORKSPACE GROUPS [ <like> ]
|
|
71
|
+
[ <extended> ] [ <order-by> ]
|
|
72
|
+
[ <limit> ];
|
|
60
73
|
|
|
61
74
|
Description
|
|
62
75
|
-----------
|
|
63
|
-
|
|
76
|
+
Displays information on workspace groups.
|
|
77
|
+
|
|
78
|
+
Arguments
|
|
79
|
+
---------
|
|
80
|
+
* ``<pattern>``: A pattern similar to SQL LIKE clause.
|
|
81
|
+
Uses ``%`` as the wildcard character.
|
|
64
82
|
|
|
65
83
|
Remarks
|
|
66
84
|
-------
|
|
67
|
-
* ``LIKE``
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* ``
|
|
85
|
+
* Use the ``LIKE`` clause to specify a pattern and return only the
|
|
86
|
+
workspace groups that match the specified pattern.
|
|
87
|
+
* The ``LIMIT`` clause limits the number of results to the
|
|
88
|
+
specified number.
|
|
89
|
+
* Use the ``ORDER BY`` clause to sort the results by the specified
|
|
90
|
+
key. By default, the results are sorted in the ascending order.
|
|
91
|
+
* To return more information about the workspace groups, use the
|
|
92
|
+
``EXTENDED`` clause.
|
|
72
93
|
|
|
73
94
|
Example
|
|
74
95
|
-------
|
|
75
|
-
|
|
96
|
+
The following command displays a list of workspace groups with names
|
|
97
|
+
that match the specified pattern::
|
|
76
98
|
|
|
77
99
|
SHOW WORKSPACE GROUPS LIKE 'Marketing%' EXTENDED ORDER BY Name;
|
|
78
100
|
|
|
79
101
|
See Also
|
|
80
102
|
--------
|
|
81
|
-
* SHOW WORKSPACES
|
|
103
|
+
* ``SHOW WORKSPACES``
|
|
82
104
|
|
|
83
105
|
"""
|
|
84
106
|
|
|
@@ -119,7 +141,9 @@ ShowWorkspaceGroupsHandler.register(overwrite=True)
|
|
|
119
141
|
|
|
120
142
|
class ShowWorkspacesHandler(SQLHandler):
|
|
121
143
|
"""
|
|
122
|
-
SHOW WORKSPACES [ in_group ]
|
|
144
|
+
SHOW WORKSPACES [ in_group ]
|
|
145
|
+
[ <like> ] [ <extended> ]
|
|
146
|
+
[ <order-by> ] [ <limit> ];
|
|
123
147
|
|
|
124
148
|
# Workspace group
|
|
125
149
|
in_group = IN GROUP { group_id | group_name }
|
|
@@ -132,27 +156,42 @@ class ShowWorkspacesHandler(SQLHandler):
|
|
|
132
156
|
|
|
133
157
|
Description
|
|
134
158
|
-----------
|
|
135
|
-
|
|
159
|
+
Displays information on workspaces in a workspace group.
|
|
160
|
+
|
|
161
|
+
Arguments
|
|
162
|
+
---------
|
|
163
|
+
* ``<group_id>``: The ID of the workspace group that contains
|
|
164
|
+
the workspace.
|
|
165
|
+
* ``<group_name>``: The name of the workspace group that
|
|
166
|
+
contains the workspace.
|
|
167
|
+
* ``<pattern>``: A pattern similar to SQL LIKE clause.
|
|
168
|
+
Uses ``%`` as the wildcard character.
|
|
136
169
|
|
|
137
170
|
Remarks
|
|
138
171
|
-------
|
|
139
|
-
* ``IN GROUP`` specifies the
|
|
140
|
-
workspace group
|
|
141
|
-
* ``LIKE``
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
* ``
|
|
172
|
+
* The ``IN GROUP`` clause specifies the ID or the name of the
|
|
173
|
+
workspace group that contains the workspace.
|
|
174
|
+
* Use the ``LIKE`` clause to specify a pattern and return only
|
|
175
|
+
the workspaces that match the specified pattern.
|
|
176
|
+
* The ``LIMIT`` clause limits the number of results to the
|
|
177
|
+
specified number.
|
|
178
|
+
* Use the ``ORDER BY`` clause to sort the results by the
|
|
179
|
+
specified key. By default, the results are sorted in the
|
|
180
|
+
ascending order.
|
|
181
|
+
* To return more information about the workspaces, use the
|
|
182
|
+
``EXTENDED`` clause.
|
|
146
183
|
|
|
147
184
|
Example
|
|
148
185
|
-------
|
|
149
|
-
|
|
186
|
+
The following command displays information on all the workspaces
|
|
187
|
+
in a workspace group named **wsg1** and sorts the results by
|
|
188
|
+
workspace name in the ascending order::
|
|
150
189
|
|
|
151
|
-
SHOW WORKSPACES IN GROUP '
|
|
190
|
+
SHOW WORKSPACES IN GROUP 'wsg1' EXTENDED ORDER BY Name;
|
|
152
191
|
|
|
153
192
|
See Also
|
|
154
193
|
--------
|
|
155
|
-
* SHOW WORKSPACE GROUPS
|
|
194
|
+
* ``SHOW WORKSPACE GROUPS``
|
|
156
195
|
|
|
157
196
|
"""
|
|
158
197
|
|
|
@@ -243,42 +282,60 @@ class CreateWorkspaceGroupHandler(SQLHandler):
|
|
|
243
282
|
|
|
244
283
|
Description
|
|
245
284
|
-----------
|
|
246
|
-
|
|
285
|
+
Creates a workspace group.
|
|
286
|
+
|
|
287
|
+
Arguments
|
|
288
|
+
---------
|
|
289
|
+
* ``<group-name>``: The name of the workspace group.
|
|
290
|
+
* ``<region_id>`` or ``<region_name>``: The ID or the name of the region
|
|
291
|
+
in which the new workspace group is created.
|
|
292
|
+
* ``<password>``: The admin password of the workspace group.
|
|
293
|
+
The password must contain:
|
|
294
|
+
- At least 8 characters
|
|
295
|
+
- At least one uppercase character
|
|
296
|
+
- At least one lowercase character
|
|
297
|
+
- At least one number or special character
|
|
298
|
+
* ``<expiry_time>``: The timestamp of when the workspace group terminates.
|
|
299
|
+
Expiration time can be specified as a timestamp or duration.
|
|
300
|
+
* ``<ip_range>``: A list of allowed IP addresses or CIDR ranges.
|
|
301
|
+
* ``<backup_key_id>``: The KMS key ID associated with the backup bucket.
|
|
302
|
+
* ``<data_key_id>``: The KMS key ID associated with the data bucket.
|
|
303
|
+
* ``<day>:<hour>``: The day of the week (0-6) and the hour of the day
|
|
304
|
+
(0-23) when the engine updates are applied to the workspace group.
|
|
247
305
|
|
|
248
306
|
Remarks
|
|
249
307
|
-------
|
|
250
|
-
* ``IF NOT EXISTS``
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
*
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
* ``ALLOW ALL TRAFFIC`` allows all incoming traffic.
|
|
264
|
-
* ``WITH UPDATE WINDOW`` specifies tha day (0-6) and hour (0-23) of the
|
|
265
|
-
update window.
|
|
308
|
+
* Specify the ``IF NOT EXISTS`` clause to create a new workspace group only
|
|
309
|
+
if a workspace group with the specified name does not exist.
|
|
310
|
+
* If the ``WITH BACKUP BUCKET KMS KEY ID '<backup_key_id>'`` clause is
|
|
311
|
+
specified, Customer-Managed Encryption Keys (CMEK) encryption is enabled
|
|
312
|
+
for the data bucket of the workspace group.
|
|
313
|
+
* If the ``WITH DATA BUCKET KMS KEY ID '<data_key_id>'`` clause is specified,
|
|
314
|
+
CMEK encryption for the data bucket and Amazon Elastic Block Store (EBS)
|
|
315
|
+
volumes of the workspace group is enabled.
|
|
316
|
+
* To enable Smart Disaster Recovery (SmartDR) for the workspace group, specify
|
|
317
|
+
the WITH SMART DR clause. Refer to Smart Disaster Recovery (DR):
|
|
318
|
+
SmartDR for more information.
|
|
319
|
+
* To allow incoming traffic from any IP address, use the ``ALLOW ALL TRAFFIC``
|
|
320
|
+
clause.
|
|
266
321
|
|
|
267
322
|
Examples
|
|
268
323
|
--------
|
|
269
|
-
|
|
324
|
+
The following command creates a workspace group named wsg1 in the
|
|
325
|
+
US East 2 (Ohio) region::
|
|
270
326
|
|
|
271
|
-
CREATE WORKSPACE GROUP '
|
|
327
|
+
CREATE WORKSPACE GROUP 'wsg1' IN REGION 'US East 2 (Ohio)';
|
|
272
328
|
|
|
273
|
-
|
|
329
|
+
The following command specifies additional workspace group configuration
|
|
330
|
+
options::
|
|
274
331
|
|
|
275
|
-
CREATE WORKSPACE GROUP '
|
|
276
|
-
|
|
277
|
-
|
|
332
|
+
CREATE WORKSPACE GROUP 'wsg1'
|
|
333
|
+
IN REGION ID '93b61160-0000-1000-9000-977b8e2e3ee5'
|
|
334
|
+
WITH FIREWALL RANGES '0.0.0.0/0';
|
|
278
335
|
|
|
279
336
|
See Also
|
|
280
337
|
--------
|
|
281
|
-
* SHOW WORKSPACE GROUPS
|
|
338
|
+
* ``SHOW WORKSPACE GROUPS``
|
|
282
339
|
|
|
283
340
|
"""
|
|
284
341
|
|
|
@@ -332,9 +389,13 @@ CreateWorkspaceGroupHandler.register(overwrite=True)
|
|
|
332
389
|
|
|
333
390
|
class CreateWorkspaceHandler(SQLHandler):
|
|
334
391
|
"""
|
|
335
|
-
CREATE WORKSPACE [ if_not_exists ] workspace_name
|
|
336
|
-
|
|
337
|
-
|
|
392
|
+
CREATE WORKSPACE [ if_not_exists ] workspace_name
|
|
393
|
+
[ in_group ]
|
|
394
|
+
WITH SIZE size
|
|
395
|
+
[ auto_suspend ]
|
|
396
|
+
[ enable_kai ]
|
|
397
|
+
[ with_cache_config ]
|
|
398
|
+
[ wait_on_active ];
|
|
338
399
|
|
|
339
400
|
# Create workspace in workspace group
|
|
340
401
|
in_group = IN GROUP { group_id | group_name }
|
|
@@ -370,33 +431,47 @@ class CreateWorkspaceHandler(SQLHandler):
|
|
|
370
431
|
|
|
371
432
|
Description
|
|
372
433
|
-----------
|
|
373
|
-
|
|
434
|
+
Creates a new workspace. Refer to
|
|
435
|
+
`Creating and Using Workspaces <https://docs.singlestore.com/cloud/getting-started-with-singlestore-helios/about-workspaces/creating-and-using-workspaces/>`_
|
|
436
|
+
for more information.
|
|
437
|
+
|
|
438
|
+
Arguments
|
|
439
|
+
---------
|
|
440
|
+
* ``<workspace_name>``: The name of the workspace.
|
|
441
|
+
* ``<group_id>`` or ``<group_name>``: The ID or name of the workspace group
|
|
442
|
+
in which the workspace is created.
|
|
443
|
+
* ``<workspace_size>``: The size of the workspace in workspace size notation,
|
|
444
|
+
for example "S-1".
|
|
445
|
+
* ``<suspend_time>``: The time (in seconds) after which the workspace is
|
|
446
|
+
suspended, according to the specified auto-suspend type.
|
|
447
|
+
* ``<multiplier>``: The multiplier for the persistent cache associated with
|
|
448
|
+
the workspace.
|
|
374
449
|
|
|
375
450
|
Remarks
|
|
376
451
|
-------
|
|
377
|
-
* ``IF NOT EXISTS``
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
* ``
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
the workspace has reached the ACTIVE state.
|
|
452
|
+
* Use the ``IF NOT EXISTS`` clause to create a new workspace only if a workspace
|
|
453
|
+
with the specified name does not exist.
|
|
454
|
+
* If the ``WITH CACHE CONFIG <multiplier>`` clause is specified, the cache
|
|
455
|
+
configuration multiplier is enabled for the workspace. It can have the
|
|
456
|
+
following values: 1, 2, or 4.
|
|
457
|
+
* The ``WAIT ON ACTIVE`` clause indicates that the execution is paused until this
|
|
458
|
+
workspace is in ACTIVE state.
|
|
459
|
+
* Specify the ``ENABLE KAI`` clause to enable SingleStore Kai and the MongoDB®
|
|
460
|
+
API for the workspace.
|
|
387
461
|
|
|
388
462
|
Example
|
|
389
463
|
-------
|
|
390
|
-
|
|
464
|
+
The following command creates a workspace named **examplews** in a workspace
|
|
465
|
+
group named **wsg1**::
|
|
391
466
|
|
|
392
|
-
CREATE WORKSPACE '
|
|
393
|
-
|
|
467
|
+
CREATE WORKSPACE 'examplews' IN GROUP 'wsgroup1'
|
|
468
|
+
WITH SIZE 'S-00' WAIT ON ACTIVE;
|
|
394
469
|
|
|
395
470
|
See Also
|
|
396
471
|
--------
|
|
397
|
-
* CREATE WORKSPACE GROUP
|
|
472
|
+
* ``CREATE WORKSPACE GROUP``
|
|
398
473
|
|
|
399
|
-
"""
|
|
474
|
+
""" # noqa: E501
|
|
400
475
|
|
|
401
476
|
def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
|
|
402
477
|
workspace_group = get_workspace_group(params)
|
|
@@ -433,7 +508,9 @@ CreateWorkspaceHandler.register(overwrite=True)
|
|
|
433
508
|
|
|
434
509
|
class SuspendWorkspaceHandler(SQLHandler):
|
|
435
510
|
"""
|
|
436
|
-
SUSPEND WORKSPACE workspace
|
|
511
|
+
SUSPEND WORKSPACE workspace
|
|
512
|
+
[ in_group ]
|
|
513
|
+
[ wait_on_suspended ];
|
|
437
514
|
|
|
438
515
|
# Workspace
|
|
439
516
|
workspace = { workspace_id | workspace_name }
|
|
@@ -458,20 +535,37 @@ class SuspendWorkspaceHandler(SQLHandler):
|
|
|
458
535
|
|
|
459
536
|
Description
|
|
460
537
|
-----------
|
|
461
|
-
|
|
538
|
+
Suspends a workspace.
|
|
539
|
+
|
|
540
|
+
Refer to `Manage Workspaces <https://docs.singlestore.com/cloud/user-and-workspace-administration/manage-organizations/manage-workspaces/>`_
|
|
541
|
+
for more information.
|
|
542
|
+
|
|
543
|
+
Arguments
|
|
544
|
+
---------
|
|
545
|
+
* ``<workspace-id>``: The ID of the workspace to suspend.
|
|
546
|
+
* ``<workspace-name>``: The name of the workspace to suspend.
|
|
547
|
+
* ``<group-id>``: The ID of the workspace group that contains
|
|
548
|
+
the workspace.
|
|
549
|
+
* ``<group-name>``: The name of the workspace group that
|
|
550
|
+
contains the workspace.
|
|
462
551
|
|
|
463
552
|
Remarks
|
|
464
553
|
-------
|
|
465
|
-
*
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
554
|
+
* Use the ``WAIT ON SUSPENDED`` clause to pause query execution
|
|
555
|
+
until the workspace is in the ``SUSPENDED`` state.
|
|
556
|
+
|
|
557
|
+
Example
|
|
558
|
+
-------
|
|
559
|
+
The following example suspends a workspace named examplews in
|
|
560
|
+
a workspace group named **wsg1**::
|
|
561
|
+
|
|
562
|
+
SUSPEND WORKSPACE 'examplews' IN GROUP 'wsg1';
|
|
469
563
|
|
|
470
564
|
See Also
|
|
471
565
|
--------
|
|
472
|
-
* RESUME WORKSPACE
|
|
566
|
+
* ``RESUME WORKSPACE``
|
|
473
567
|
|
|
474
|
-
"""
|
|
568
|
+
""" # noqa: E501
|
|
475
569
|
|
|
476
570
|
def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
|
|
477
571
|
ws = get_workspace(params)
|
|
@@ -484,8 +578,10 @@ SuspendWorkspaceHandler.register(overwrite=True)
|
|
|
484
578
|
|
|
485
579
|
class ResumeWorkspaceHandler(SQLHandler):
|
|
486
580
|
"""
|
|
487
|
-
RESUME WORKSPACE workspace
|
|
488
|
-
[
|
|
581
|
+
RESUME WORKSPACE workspace
|
|
582
|
+
[ in_group ]
|
|
583
|
+
[ disable_auto_suspend ]
|
|
584
|
+
[ wait_on_resumed ];
|
|
489
585
|
|
|
490
586
|
# Workspace
|
|
491
587
|
workspace = { workspace_id | workspace_name }
|
|
@@ -513,16 +609,38 @@ class ResumeWorkspaceHandler(SQLHandler):
|
|
|
513
609
|
|
|
514
610
|
Description
|
|
515
611
|
-----------
|
|
516
|
-
|
|
612
|
+
Resumes a workspace.
|
|
613
|
+
|
|
614
|
+
Refer to `Manage Workspaces <https://docs.singlestore.com/cloud/user-and-workspace-administration/manage-organizations/manage-workspaces/>`_
|
|
615
|
+
for more information.
|
|
616
|
+
|
|
617
|
+
Arguments
|
|
618
|
+
---------
|
|
619
|
+
* ``<workspace-id>``: The ID of the workspace to resume.
|
|
620
|
+
* ``<workspace-name>``: The name of the workspace to resume.
|
|
621
|
+
* ``<group_id>``: The ID of the workspace group that contains
|
|
622
|
+
the workspace.
|
|
623
|
+
* ``<group_name>``: The name of the workspace group that
|
|
624
|
+
contains the workspace.
|
|
517
625
|
|
|
518
626
|
Remarks
|
|
519
627
|
-------
|
|
520
|
-
* ``IN GROUP``
|
|
521
|
-
|
|
522
|
-
* ``WAIT ON RESUMED``
|
|
523
|
-
the workspace
|
|
628
|
+
* Use the ``IN GROUP`` clause to specify the ID or name of the
|
|
629
|
+
workspace group that contains the workspace to resume.
|
|
630
|
+
* Use the ``WAIT ON RESUMED`` clause to pause query execution
|
|
631
|
+
until the workspace is in the ``RESUMED`` state.
|
|
632
|
+
* Specify the ``DISABLE AUTO SUSPEND`` clause to disable
|
|
633
|
+
auto-suspend for the resumed workspace.
|
|
524
634
|
|
|
525
|
-
|
|
635
|
+
Example
|
|
636
|
+
-------
|
|
637
|
+
The following example resumes a workspace with the specified ID
|
|
638
|
+
in a workspace group named **wsg1**::
|
|
639
|
+
|
|
640
|
+
RESUME WORKSPACE ID '93b61160-0000-1000-9000-977b8e2e3ee5'
|
|
641
|
+
IN GROUP 'wsg1';
|
|
642
|
+
|
|
643
|
+
""" # noqa: E501
|
|
526
644
|
|
|
527
645
|
def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
|
|
528
646
|
ws = get_workspace(params)
|
|
@@ -538,7 +656,10 @@ ResumeWorkspaceHandler.register(overwrite=True)
|
|
|
538
656
|
|
|
539
657
|
class DropWorkspaceGroupHandler(SQLHandler):
|
|
540
658
|
"""
|
|
541
|
-
DROP WORKSPACE GROUP [ if_exists ]
|
|
659
|
+
DROP WORKSPACE GROUP [ if_exists ]
|
|
660
|
+
group
|
|
661
|
+
[ wait_on_terminated ]
|
|
662
|
+
[ force ];
|
|
542
663
|
|
|
543
664
|
# Only run command if the workspace group exists
|
|
544
665
|
if_exists = IF EXISTS
|
|
@@ -560,26 +681,32 @@ class DropWorkspaceGroupHandler(SQLHandler):
|
|
|
560
681
|
|
|
561
682
|
Description
|
|
562
683
|
-----------
|
|
563
|
-
|
|
684
|
+
Deletes the specified workspace group.
|
|
685
|
+
|
|
686
|
+
Arguments
|
|
687
|
+
---------
|
|
688
|
+
* ``<group_id>``: The ID of the workspace group to delete.
|
|
689
|
+
* ``<group_name>``: The name of the workspace group to delete.
|
|
564
690
|
|
|
565
691
|
Remarks
|
|
566
692
|
-------
|
|
567
|
-
* ``IF EXISTS``
|
|
568
|
-
only
|
|
569
|
-
* ``WAIT ON TERMINATED``
|
|
570
|
-
|
|
571
|
-
* ``FORCE``
|
|
572
|
-
even if it contains workspaces.
|
|
693
|
+
* Specify the ``IF EXISTS`` clause to attempt the delete operation
|
|
694
|
+
only if a workspace group with the specified ID or name exists.
|
|
695
|
+
* Use the ``WAIT ON TERMINATED`` clause to pause query execution until
|
|
696
|
+
the workspace group is in the ``TERMINATED`` state.
|
|
697
|
+
* If the ``FORCE`` clause is specified, the workspace group is
|
|
698
|
+
terminated even if it contains workspaces.
|
|
573
699
|
|
|
574
700
|
Example
|
|
575
701
|
-------
|
|
576
|
-
|
|
702
|
+
The following command deletes a workspace group named **wsg1** even
|
|
703
|
+
if it contains workspaces::
|
|
577
704
|
|
|
578
|
-
DROP WORKSPACE GROUP '
|
|
705
|
+
DROP WORKSPACE GROUP 'wsg1' FORCE;
|
|
579
706
|
|
|
580
707
|
See Also
|
|
581
708
|
--------
|
|
582
|
-
* DROP WORKSPACE
|
|
709
|
+
* ``DROP WORKSPACE``
|
|
583
710
|
|
|
584
711
|
"""
|
|
585
712
|
|
|
@@ -605,7 +732,10 @@ DropWorkspaceGroupHandler.register(overwrite=True)
|
|
|
605
732
|
|
|
606
733
|
class DropWorkspaceHandler(SQLHandler):
|
|
607
734
|
"""
|
|
608
|
-
DROP WORKSPACE [ if_exists ]
|
|
735
|
+
DROP WORKSPACE [ if_exists ]
|
|
736
|
+
workspace
|
|
737
|
+
[ in_group ]
|
|
738
|
+
[ wait_on_terminated ];
|
|
609
739
|
|
|
610
740
|
# Only drop workspace if it exists
|
|
611
741
|
if_exists = IF EXISTS
|
|
@@ -633,26 +763,38 @@ class DropWorkspaceHandler(SQLHandler):
|
|
|
633
763
|
|
|
634
764
|
Description
|
|
635
765
|
-----------
|
|
636
|
-
|
|
766
|
+
Deletes a workspace.
|
|
767
|
+
|
|
768
|
+
Arguments
|
|
769
|
+
---------
|
|
770
|
+
* ``<workspace-id>``: The ID of the workspace to delete.
|
|
771
|
+
* ``<workspace-name>``: The name of the workspace to delete.
|
|
772
|
+
* ``<group_id>``: The ID of the workspace group that contains
|
|
773
|
+
the workspace.
|
|
774
|
+
* ``<group_name>``: The name of the workspace group that
|
|
775
|
+
contains the workspace.
|
|
637
776
|
|
|
638
777
|
Remarks
|
|
639
778
|
-------
|
|
640
|
-
* ``IF EXISTS``
|
|
641
|
-
only
|
|
642
|
-
* ``IN GROUP``
|
|
643
|
-
|
|
644
|
-
* ``WAIT ON TERMINATED``
|
|
645
|
-
|
|
779
|
+
* Specify the ``IF EXISTS`` clause to attempt the delete operation
|
|
780
|
+
only if a workspace with the specified ID or name exists.
|
|
781
|
+
* Use the ``IN GROUP`` clause to specify the ID or name of the workspace
|
|
782
|
+
group that contains the workspace to delete.
|
|
783
|
+
* Use the ``WAIT ON TERMINATED`` clause to pause query execution until
|
|
784
|
+
the workspace is in the ``TERMINATED`` state.
|
|
785
|
+
* All databases attached to the workspace are detached when the
|
|
786
|
+
workspace is deleted (terminated).
|
|
646
787
|
|
|
647
788
|
Example
|
|
648
789
|
-------
|
|
649
|
-
|
|
790
|
+
The following example deletes a workspace named **examplews** in
|
|
791
|
+
a workspace group **wsg1**::
|
|
650
792
|
|
|
651
|
-
DROP WORKSPACE IF EXISTS '
|
|
793
|
+
DROP WORKSPACE IF EXISTS 'examplews' IN GROUP 'wsg1';
|
|
652
794
|
|
|
653
795
|
See Also
|
|
654
796
|
--------
|
|
655
|
-
* DROP WORKSPACE GROUP
|
|
797
|
+
* ``DROP WORKSPACE GROUP``
|
|
656
798
|
|
|
657
799
|
"""
|
|
658
800
|
|
singlestoredb/fusion/registry.py
CHANGED
|
@@ -123,17 +123,28 @@ class ShowFusionCommandsHandler(SQLHandler):
|
|
|
123
123
|
|
|
124
124
|
Description
|
|
125
125
|
-----------
|
|
126
|
-
|
|
126
|
+
Displays a list of all the Fusion commands.
|
|
127
|
+
|
|
128
|
+
Arguments
|
|
129
|
+
---------
|
|
130
|
+
* `<pattern>``: A pattern similar to SQL LIKE clause. Uses ``%`` as
|
|
131
|
+
the wildcard character.
|
|
127
132
|
|
|
128
133
|
Remarks
|
|
129
134
|
-------
|
|
130
|
-
* ``LIKE``
|
|
135
|
+
* Use the ``LIKE`` clause to specify a pattern and return only the
|
|
136
|
+
commands that match the specified pattern.
|
|
131
137
|
|
|
132
138
|
Example
|
|
133
139
|
-------
|
|
134
|
-
|
|
140
|
+
The following command returns all the Fusion commands that start
|
|
141
|
+
with 'SHOW'::
|
|
142
|
+
|
|
143
|
+
SHOW FUSION COMMANDS LIKE 'SHOW%'
|
|
135
144
|
|
|
136
|
-
|
|
145
|
+
See Also
|
|
146
|
+
--------
|
|
147
|
+
* ``SHOW FUSION HELP``
|
|
137
148
|
|
|
138
149
|
"""
|
|
139
150
|
|
|
@@ -167,13 +178,14 @@ class ShowFusionGrammarHandler(SQLHandler):
|
|
|
167
178
|
-----------
|
|
168
179
|
Show the full grammar of a Fusion SQL command for a given query.
|
|
169
180
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
* ``<
|
|
181
|
+
Arguments
|
|
182
|
+
---------
|
|
183
|
+
* ``<command>``: A Fusion command.
|
|
173
184
|
|
|
174
185
|
Example
|
|
175
186
|
-------
|
|
176
|
-
|
|
187
|
+
The following command displays the grammar for the
|
|
188
|
+
``CREATE WORKSPACE`` Fusion command::
|
|
177
189
|
|
|
178
190
|
SHOW FUSION GRAMMAR FOR 'CREATE WORKSPACE';
|
|
179
191
|
|
|
@@ -202,11 +214,16 @@ class ShowFusionHelpHandler(SQLHandler):
|
|
|
202
214
|
|
|
203
215
|
Description
|
|
204
216
|
-----------
|
|
205
|
-
|
|
217
|
+
Displays the documentation for a Fusion command.
|
|
218
|
+
|
|
219
|
+
Arguments
|
|
220
|
+
---------
|
|
221
|
+
* ``<command>``: A Fusion command.
|
|
206
222
|
|
|
207
223
|
Example
|
|
208
224
|
-------
|
|
209
|
-
|
|
225
|
+
The following command displays the documentation for
|
|
226
|
+
the ``CREATE WORKSPACE`` Fusion command.
|
|
210
227
|
|
|
211
228
|
SHOW FUSION HELP FOR 'CREATE WORKSPACE';
|
|
212
229
|
|
singlestoredb/http/connection.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import datetime
|
|
4
4
|
import decimal
|
|
5
5
|
import functools
|
|
6
|
+
import io
|
|
6
7
|
import json
|
|
7
8
|
import math
|
|
8
9
|
import os
|
|
@@ -420,6 +421,14 @@ class Cursor(connection.Cursor):
|
|
|
420
421
|
def execute(
|
|
421
422
|
self, query: str,
|
|
422
423
|
args: Optional[Union[Sequence[Any], Dict[str, Any]]] = None,
|
|
424
|
+
infile_stream: Optional[ # type: ignore
|
|
425
|
+
Union[
|
|
426
|
+
io.RawIOBase,
|
|
427
|
+
io.TextIOBase,
|
|
428
|
+
Iterable[Union[bytes, str]],
|
|
429
|
+
connection.InfileQueue,
|
|
430
|
+
]
|
|
431
|
+
] = None,
|
|
423
432
|
) -> int:
|
|
424
433
|
"""
|
|
425
434
|
Execute a SQL statement.
|
|
@@ -432,7 +441,7 @@ class Cursor(connection.Cursor):
|
|
|
432
441
|
Parameters to substitute into the SQL code
|
|
433
442
|
|
|
434
443
|
"""
|
|
435
|
-
return self._execute(query, args)
|
|
444
|
+
return self._execute(query, args, infile_stream=infile_stream)
|
|
436
445
|
|
|
437
446
|
def _validate_param_subs(
|
|
438
447
|
self, query: str,
|
|
@@ -496,6 +505,14 @@ class Cursor(connection.Cursor):
|
|
|
496
505
|
self, oper: str,
|
|
497
506
|
params: Optional[Union[Sequence[Any], Dict[str, Any]]] = None,
|
|
498
507
|
is_callproc: bool = False,
|
|
508
|
+
infile_stream: Optional[ # type: ignore
|
|
509
|
+
Union[
|
|
510
|
+
io.RawIOBase,
|
|
511
|
+
io.TextIOBase,
|
|
512
|
+
Iterable[Union[bytes, str]],
|
|
513
|
+
connection.InfileQueue,
|
|
514
|
+
]
|
|
515
|
+
] = None,
|
|
499
516
|
) -> int:
|
|
500
517
|
self._descriptions = []
|
|
501
518
|
self._schemas = []
|