singlestoredb 1.4.3__py3-none-any.whl → 1.6.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 +11 -0
- singlestoredb/connection.py +3 -0
- singlestoredb/fusion/handler.py +17 -9
- singlestoredb/fusion/handlers/job.py +658 -0
- singlestoredb/fusion/handlers/workspace.py +81 -5
- singlestoredb/http/connection.py +2 -0
- singlestoredb/management/job.py +887 -0
- singlestoredb/management/organization.py +17 -0
- singlestoredb/management/utils.py +47 -1
- singlestoredb/mysql/connection.py +19 -0
- singlestoredb/notebook/_portal.py +32 -0
- singlestoredb/tests/test_fusion.py +250 -1
- singlestoredb/tests/test_management.py +152 -0
- singlestoredb/tests/utils.py +7 -0
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/METADATA +1 -1
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/RECORD +21 -19
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/LICENSE +0 -0
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/WHEEL +0 -0
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.4.3.dist-info → singlestoredb-1.6.0.dist-info}/top_level.txt +0 -0
singlestoredb/__init__.py
CHANGED
singlestoredb/config.py
CHANGED
|
@@ -221,6 +221,17 @@ register_option(
|
|
|
221
221
|
environ='SINGLESTOREDB_ENABLE_EXTENDED_DATA_TYPES',
|
|
222
222
|
)
|
|
223
223
|
|
|
224
|
+
register_option(
|
|
225
|
+
'vector_data_format', 'string',
|
|
226
|
+
functools.partial(
|
|
227
|
+
check_str,
|
|
228
|
+
valid_values=['json', 'binary'],
|
|
229
|
+
),
|
|
230
|
+
'binary',
|
|
231
|
+
'Format for vector data values',
|
|
232
|
+
environ='SINGLESTOREDB_VECTOR_DATA_FORMAT',
|
|
233
|
+
)
|
|
234
|
+
|
|
224
235
|
register_option(
|
|
225
236
|
'fusion.enabled', 'bool', check_bool, False,
|
|
226
237
|
'Should Fusion SQL queries be enabled?',
|
singlestoredb/connection.py
CHANGED
|
@@ -1304,6 +1304,7 @@ def connect(
|
|
|
1304
1304
|
encoding_errors: Optional[str] = None,
|
|
1305
1305
|
track_env: Optional[bool] = None,
|
|
1306
1306
|
enable_extended_data_types: Optional[bool] = None,
|
|
1307
|
+
vector_data_format: Optional[str] = None,
|
|
1307
1308
|
) -> Connection:
|
|
1308
1309
|
"""
|
|
1309
1310
|
Return a SingleStoreDB connection.
|
|
@@ -1387,6 +1388,8 @@ def connect(
|
|
|
1387
1388
|
Should the connection track the SINGLESTOREDB_URL environment variable?
|
|
1388
1389
|
enable_extended_data_types : bool, optional
|
|
1389
1390
|
Should extended data types (BSON, vector) be enabled?
|
|
1391
|
+
vector_data_format : str, optional
|
|
1392
|
+
Format for vector types: json or binary
|
|
1390
1393
|
|
|
1391
1394
|
Examples
|
|
1392
1395
|
--------
|
singlestoredb/fusion/handler.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import abc
|
|
3
3
|
import functools
|
|
4
4
|
import re
|
|
5
|
+
import sys
|
|
5
6
|
import textwrap
|
|
6
7
|
from typing import Any
|
|
7
8
|
from typing import Callable
|
|
@@ -102,7 +103,7 @@ def json_unescape(s: str) -> str:
|
|
|
102
103
|
|
|
103
104
|
def get_keywords(grammar: str) -> Tuple[str, ...]:
|
|
104
105
|
"""Return all all-caps words from the beginning of the line."""
|
|
105
|
-
m = re.match(r'^\s*((?:[A-Z0-9_]+)(\s+|$|;))+', grammar)
|
|
106
|
+
m = re.match(r'^\s*((?:[@A-Z0-9_]+)(\s+|$|;))+', grammar)
|
|
106
107
|
if not m:
|
|
107
108
|
return tuple()
|
|
108
109
|
return tuple(re.split(r'\s+', m.group(0).replace(';', '').strip()))
|
|
@@ -110,7 +111,7 @@ def get_keywords(grammar: str) -> Tuple[str, ...]:
|
|
|
110
111
|
|
|
111
112
|
def is_bool(grammar: str) -> bool:
|
|
112
113
|
"""Determine if the rule is a boolean."""
|
|
113
|
-
return bool(re.match(r'^[A-Z0-9_\s*]+$', grammar))
|
|
114
|
+
return bool(re.match(r'^[@A-Z0-9_\s*]+$', grammar))
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
def process_optional(m: Any) -> str:
|
|
@@ -137,8 +138,9 @@ def process_repeats(m: Any) -> str:
|
|
|
137
138
|
|
|
138
139
|
def lower_and_regex(m: Any) -> str:
|
|
139
140
|
"""Lowercase and convert literal to regex."""
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
start = m.group(1) or ''
|
|
142
|
+
sql = m.group(2)
|
|
143
|
+
return f'~"{start}{sql.lower()}"i'
|
|
142
144
|
|
|
143
145
|
|
|
144
146
|
def split_unions(grammar: str) -> str:
|
|
@@ -415,7 +417,7 @@ def process_grammar(
|
|
|
415
417
|
sql = re.sub(r'\]\s+\[', r' | ', sql)
|
|
416
418
|
|
|
417
419
|
# Lower-case keywords and make them case-insensitive
|
|
418
|
-
sql = re.sub(r'\b([A-Z0-9]+)\b', lower_and_regex, sql)
|
|
420
|
+
sql = re.sub(r'(\b|@+)([A-Z0-9]+)\b', lower_and_regex, sql)
|
|
419
421
|
|
|
420
422
|
# Convert literal strings to 'qs'
|
|
421
423
|
sql = re.sub(r"'[^']+'", r'qs', sql)
|
|
@@ -479,10 +481,16 @@ def process_grammar(
|
|
|
479
481
|
cmds = ' / '.join(x for x in rules if x.endswith('_cmd'))
|
|
480
482
|
cmds = f'init = ws* ( {cmds} ) ws* ";"? ws*\n'
|
|
481
483
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
grammar = cmds + CORE_GRAMMAR + '\n'.join(out)
|
|
485
|
+
|
|
486
|
+
try:
|
|
487
|
+
return (
|
|
488
|
+
Grammar(grammar), command_key,
|
|
489
|
+
rule_info, syntax_txt, help_txt,
|
|
490
|
+
)
|
|
491
|
+
except ParseError:
|
|
492
|
+
print(grammar, file=sys.stderr)
|
|
493
|
+
raise
|
|
486
494
|
|
|
487
495
|
|
|
488
496
|
def flatten(items: Iterable[Any]) -> List[Any]:
|