singlestoredb 1.4.1__cp38-abi3-win32.whl → 1.4.2__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 CHANGED
Binary file
singlestoredb/__init__.py CHANGED
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.4.1'
16
+ __version__ = '1.4.2'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -28,8 +28,23 @@ CORE_GRAMMAR = r'''
28
28
  eq = ws* "=" ws*
29
29
  open_paren = ws* "(" ws*
30
30
  close_paren = ws* ")" ws*
31
+ open_repeats = ws* ~r"[\(\[\{]" ws*
32
+ close_repeats = ws* ~r"[\)\]\}]" ws*
31
33
  select = ~r"SELECT"i ws+ ~r".+" ws*
32
- '''
34
+
35
+ json = ws* json_object ws*
36
+ json_object = ~r"{\s*" json_members? ~r"\s*}"
37
+ json_members = json_mapping (~r"\s*,\s*" json_mapping)*
38
+ json_mapping = json_string ~r"\s*:\s*" json_value
39
+ json_array = ~r"\[\s*" json_items? ~r"\s*\]"
40
+ json_items = json_value (~r"\s*,\s*" json_value)*
41
+ json_value = json_object / json_array / json_string / json_true_val / json_false_val / json_null_val / json_number
42
+ json_true_val = "true"
43
+ json_false_val = "false"
44
+ json_null_val = "null"
45
+ json_string = ~r"\"[ !#-\[\]-\U0010ffff]*(?:\\(?:[\"\\/bfnrt]|u[0-9A-Fa-f]{4})[ !#-\[\]-\U0010ffff]*)*\""
46
+ json_number = ~r"-?(0|[1-9][0-9]*)(\.\d*)?([eE][-+]?\d+)?"
47
+ ''' # noqa: E501
33
48
 
34
49
  BUILTINS = {
35
50
  '<order-by>': r'''
@@ -47,6 +62,7 @@ BUILTINS = {
47
62
  ''',
48
63
  '<integer>': '',
49
64
  '<number>': '',
65
+ '<json>': '',
50
66
  }
51
67
 
52
68
  BUILTIN_DEFAULTS = { # type: ignore
@@ -54,9 +70,36 @@ BUILTIN_DEFAULTS = { # type: ignore
54
70
  'like': None,
55
71
  'extended': False,
56
72
  'limit': None,
73
+ 'json': {},
74
+ }
75
+
76
+ _json_unesc_re = re.compile(r'\\(["/\\bfnrt]|u[0-9A-Fa-f])')
77
+ _json_unesc_map = {
78
+ '"': '"',
79
+ '/': '/',
80
+ '\\': '\\',
81
+ 'b': '\b',
82
+ 'f': '\f',
83
+ 'n': '\n',
84
+ 'r': '\r',
85
+ 't': '\t',
57
86
  }
58
87
 
59
88
 
89
+ def _json_unescape(m: Any) -> str:
90
+ c = m.group(1)
91
+ if c[0] == 'u':
92
+ return chr(int(c[1:], 16))
93
+ c2 = _json_unesc_map.get(c)
94
+ if not c2:
95
+ raise ValueError(f'invalid escape sequence: {m.group(0)}')
96
+ return c2
97
+
98
+
99
+ def json_unescape(s: str) -> str:
100
+ return _json_unesc_re.sub(_json_unescape, s[1:-1])
101
+
102
+
60
103
  def get_keywords(grammar: str) -> Tuple[str, ...]:
61
104
  """Return all all-caps words from the beginning of the line."""
62
105
  m = re.match(r'^\s*((?:[A-Z0-9_]+)(\s+|$|;))+', grammar)
@@ -89,7 +132,7 @@ def process_alternates(m: Any) -> str:
89
132
  def process_repeats(m: Any) -> str:
90
133
  """Add repeated patterns."""
91
134
  sql = m.group(1).strip()
92
- return f'open_paren? {sql} ws* ( comma {sql} ws* )* close_paren?'
135
+ return f'open_repeats? {sql} ws* ( comma {sql} ws* )* close_repeats?'
93
136
 
94
137
 
95
138
  def lower_and_regex(m: Any) -> str:
@@ -639,6 +682,14 @@ class SQLHandler(NodeVisitor):
639
682
  """Close parenthesis."""
640
683
  return
641
684
 
685
+ def visit_open_repeats(self, node: Node, visited_children: Iterable[Any]) -> Any:
686
+ """Open repeat grouping."""
687
+ return
688
+
689
+ def visit_close_repeats(self, node: Node, visited_children: Iterable[Any]) -> Any:
690
+ """Close repeat grouping."""
691
+ return
692
+
642
693
  def visit_init(self, node: Node, visited_children: Iterable[Any]) -> Any:
643
694
  """Entry point of the grammar."""
644
695
  _, out, *_ = visited_children
@@ -662,6 +713,57 @@ class SQLHandler(NodeVisitor):
662
713
  ascending.append(value[1].upper().startswith('A'))
663
714
  return {'order_by': {'by': by, 'ascending': ascending}}
664
715
 
716
+ def _delimited(self, node: Node, children: Iterable[Any]) -> Any:
717
+ children = list(children)
718
+ items = [children[0]]
719
+ items.extend(item for _, item in children[1])
720
+ return items
721
+
722
+ def _atomic(self, node: Node, children: Iterable[Any]) -> Any:
723
+ return list(children)[0]
724
+
725
+ # visitors
726
+ visit_json_value = _atomic
727
+ visit_json_members = visit_json_items = _delimited
728
+
729
+ def visit_json_object(self, node: Node, children: Iterable[Any]) -> Any:
730
+ _, members, _ = children
731
+ if isinstance(members, list):
732
+ members = members[0]
733
+ else:
734
+ members = []
735
+ members = [x for x in members if x != '']
736
+ return dict(members)
737
+
738
+ def visit_json_array(self, node: Node, children: Iterable[Any]) -> Any:
739
+ _, values, _ = children
740
+ if isinstance(values, list):
741
+ values = values[0]
742
+ else:
743
+ values = []
744
+ return values
745
+
746
+ def visit_json_mapping(self, node: Node, children: Iterable[Any]) -> Any:
747
+ key, _, value = children
748
+ return key, value
749
+
750
+ def visit_json_string(self, node: Node, children: Iterable[Any]) -> Any:
751
+ return json_unescape(node.text)
752
+
753
+ def visit_json_number(self, node: Node, children: Iterable[Any]) -> Any:
754
+ if '.' in node.text:
755
+ return float(node.text)
756
+ return int(node.text)
757
+
758
+ def visit_json_true_val(self, node: Node, children: Iterable[Any]) -> Any:
759
+ return True
760
+
761
+ def visit_json_false_val(self, node: Node, children: Iterable[Any]) -> Any:
762
+ return False
763
+
764
+ def visit_json_null_val(self, node: Node, children: Iterable[Any]) -> Any:
765
+ return None
766
+
665
767
  def generic_visit(self, node: Node, visited_children: Iterable[Any]) -> Any:
666
768
  """
667
769
  Handle all undefined rules.
@@ -675,6 +777,9 @@ class SQLHandler(NodeVisitor):
675
777
  rule can have repeated values, a list of values is returned.
676
778
 
677
779
  """
780
+ if node.expr_name.startswith('json'):
781
+ return visited_children or node.text
782
+
678
783
  # Call a grammar rule
679
784
  if node.expr_name in type(self).rule_info:
680
785
  n_keywords = type(self).rule_info[node.expr_name]['n_keywords']
@@ -182,7 +182,7 @@ class Portal(object):
182
182
  id = w.id
183
183
 
184
184
  self._call_javascript(
185
- 'changeWorkspace', [id],
185
+ 'changeDeployment', [id],
186
186
  wait_on_condition=lambda: self.workspace_id == id, # type: ignore
187
187
  timeout_message='timeout waiting for workspace update',
188
188
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.4.1
3
+ Version: 1.4.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=4a9jkRxSS3bcpGAfN6Q24lKS3TvcELj3kfTKkx7A3pc,59904
2
- singlestoredb/__init__.py,sha256=KEqb2gHGKPyOxYZh-RhiXQ30pSKXzRKg-0m7pXMUPh8,1697
1
+ _singlestoredb_accel.pyd,sha256=_knrtchzdfW_J4ne4LTVb_eGZ3DZAei-3Fjrhd3aOD4,59904
2
+ singlestoredb/__init__.py,sha256=UAYUs5oB_C2Fltv2uVXynta2H-cBaMRVoJ4H_Wm9wCQ,1697
3
3
  singlestoredb/auth.py,sha256=RmYiH0Wlc2RXc4pTlRMysxtBI445ggCIwojWKC_eDLE,7844
4
4
  singlestoredb/config.py,sha256=9pVmVEZ23NfJ3pokdBDA0cX3bwUz6SbuT4AZWAcIPR4,12235
5
5
  singlestoredb/connection.py,sha256=xdjf6HX-BS9BmwdjA3IlKeZx_e691_dVFMY3GvX_v64,46629
@@ -23,7 +23,7 @@ singlestoredb/functions/ext/rowdat_1.py,sha256=KYj_y5JWm3_B2-QC47HK-CNOrzujBqGUw
23
23
  singlestoredb/functions/ext/utils.py,sha256=OPMFD-tTCx2Kk9jguQkrTr7e4AgNkt15YsvaT1YSmN8,5480
24
24
  singlestoredb/fusion/__init__.py,sha256=FHWtrg6OJFTf6Ye197V5sU6ssryr2h6FBcDIgXP7-H4,367
25
25
  singlestoredb/fusion/graphql.py,sha256=SHqsPe4xgawdsTPHEtJGQlybYGWqPrGMmyK-v20RLac,5420
26
- singlestoredb/fusion/handler.py,sha256=PZXPWFhd3BaFtnpJqK2cFTw8oOaUVGIh1cS6BvltzKk,22308
26
+ singlestoredb/fusion/handler.py,sha256=XjxyMsTaTp1MYqtYCb5rOId4RD1zye9qqFYgCZmWcM0,25808
27
27
  singlestoredb/fusion/registry.py,sha256=_eT1gd38VPlFKs5f9Pu6lqQyoDQ_ixW5O56QwYLQ89Y,6361
28
28
  singlestoredb/fusion/result.py,sha256=EcFY5Qv43ySlQsfl_JB-I3ko7PzVdjuhhoKN96uHSAM,12171
29
29
  singlestoredb/fusion/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -83,7 +83,7 @@ singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py,sha256
83
83
  singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py,sha256=K4EnQCWI_4ShmCv6xHSBDo0B2HVbJvGGYHWygp2bBBk,2920
84
84
  singlestoredb/notebook/__init__.py,sha256=XGvAnkjV_6MjaNv6aqxqDL3ovPApKmNX-2UYH1t0cec,549
85
85
  singlestoredb/notebook/_objects.py,sha256=rDfHGLLwrnuhVMOyNojzrGamykyfOQxZfH2EnFd8vEw,8256
86
- singlestoredb/notebook/_portal.py,sha256=lbZz1jtf2OjPBee6rPhVt5r8wQMijlsHvKUa6xBI46U,8766
86
+ singlestoredb/notebook/_portal.py,sha256=uMjc1LnwpSfkuQehyOxUu3WBAUdKU9EaYAJBdTDw_8E,8767
87
87
  singlestoredb/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  singlestoredb/tests/empty.sql,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  singlestoredb/tests/local_infile.csv,sha256=0fYxcZcTvcwS2McF4sktFsipRY1G-ClGmCRR1eCqdEQ,45
@@ -115,9 +115,9 @@ singlestoredb/utils/events.py,sha256=rC9cHAetua_E1f-EiFkFM-gJzQSQIH5Uk-4sspC3KjI
115
115
  singlestoredb/utils/mogrify.py,sha256=gCcn99-vgsGVjTUV7RHJ6hH4vCNrsGB_Xo4z8kiSPDQ,4201
116
116
  singlestoredb/utils/results.py,sha256=wR70LhCqlobniZf52r67zYLBOKjWHQm68NAskdRQND8,15862
117
117
  singlestoredb/utils/xdict.py,sha256=-wi1lSPTnY99fhVMBhPKJ8cCsQhNG4GMUfkEBDKYgCw,13321
118
- singlestoredb-1.4.1.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
119
- singlestoredb-1.4.1.dist-info/METADATA,sha256=S5GEdMuhGBUw8es-v-pSlzDVzQNo8OT_7A4CLCD11pU,5710
120
- singlestoredb-1.4.1.dist-info/WHEEL,sha256=c4k7z5HB0t-y0nBCv6KyJ6KCjn8SEGPddD0lhaPtU3E,96
121
- singlestoredb-1.4.1.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
122
- singlestoredb-1.4.1.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
123
- singlestoredb-1.4.1.dist-info/RECORD,,
118
+ singlestoredb-1.4.2.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
119
+ singlestoredb-1.4.2.dist-info/METADATA,sha256=Qwbk_w8_e3LSOPA4BTPsndfdXfIb6B5fGE6RZdwA9P8,5710
120
+ singlestoredb-1.4.2.dist-info/WHEEL,sha256=c4k7z5HB0t-y0nBCv6KyJ6KCjn8SEGPddD0lhaPtU3E,96
121
+ singlestoredb-1.4.2.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
122
+ singlestoredb-1.4.2.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
123
+ singlestoredb-1.4.2.dist-info/RECORD,,