singlestoredb 1.0.4__py3-none-any.whl → 1.2.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 +131 -0
- singlestoredb/connection.py +3 -0
- singlestoredb/converters.py +390 -0
- singlestoredb/functions/dtypes.py +5 -198
- singlestoredb/functions/ext/__init__.py +0 -1
- singlestoredb/functions/ext/asgi.py +671 -153
- singlestoredb/functions/ext/json.py +2 -2
- singlestoredb/functions/ext/mmap.py +174 -67
- singlestoredb/functions/ext/rowdat_1.py +2 -2
- singlestoredb/functions/ext/utils.py +169 -0
- singlestoredb/fusion/handler.py +115 -9
- singlestoredb/fusion/handlers/stage.py +246 -13
- singlestoredb/fusion/handlers/workspace.py +417 -14
- singlestoredb/fusion/registry.py +86 -1
- singlestoredb/http/connection.py +40 -2
- 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 +81 -0
- 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 +177 -4
- singlestoredb/mysql/protocol.py +50 -1
- singlestoredb/notebook/__init__.py +15 -0
- singlestoredb/notebook/_objects.py +212 -0
- singlestoredb/tests/test.sql +259 -0
- singlestoredb/tests/test_connection.py +1715 -133
- singlestoredb/tests/test_ext_func.py +2 -2
- singlestoredb/tests/test_ext_func_data.py +1 -1
- singlestoredb/utils/dtypes.py +205 -0
- singlestoredb/utils/results.py +367 -14
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/METADATA +2 -1
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/RECORD +40 -34
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/LICENSE +0 -0
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/WHEEL +0 -0
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.0.4.dist-info → singlestoredb-1.2.0.dist-info}/top_level.txt +0 -0
|
@@ -10,24 +10,11 @@ from typing import Union
|
|
|
10
10
|
|
|
11
11
|
from ..converters import converters
|
|
12
12
|
from ..mysql.converters import escape_item # type: ignore
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
has_numpy = False
|
|
19
|
-
|
|
20
|
-
try:
|
|
21
|
-
import polars as pl
|
|
22
|
-
has_polars = True
|
|
23
|
-
except ImportError:
|
|
24
|
-
has_polars = False
|
|
25
|
-
|
|
26
|
-
try:
|
|
27
|
-
import pyarrow as pa
|
|
28
|
-
has_pyarrow = True
|
|
29
|
-
except ImportError:
|
|
30
|
-
has_pyarrow = False
|
|
13
|
+
from ..utils.dtypes import DEFAULT_VALUES # noqa
|
|
14
|
+
from ..utils.dtypes import NUMPY_TYPE_MAP # noqa
|
|
15
|
+
from ..utils.dtypes import PANDAS_TYPE_MAP # noqa
|
|
16
|
+
from ..utils.dtypes import POLARS_TYPE_MAP # noqa
|
|
17
|
+
from ..utils.dtypes import PYARROW_TYPE_MAP # noqa
|
|
31
18
|
|
|
32
19
|
|
|
33
20
|
DataType = Union[str, Callable[..., Any]]
|
|
@@ -117,48 +104,6 @@ def bytestr(x: Any) -> Optional[bytes]:
|
|
|
117
104
|
return bytes.fromhex(x)
|
|
118
105
|
|
|
119
106
|
|
|
120
|
-
DEFAULT_VALUES = {
|
|
121
|
-
0: 0, # Decimal
|
|
122
|
-
1: 0, # Tiny
|
|
123
|
-
-1: 0, # Unsigned Tiny
|
|
124
|
-
2: 0, # Short
|
|
125
|
-
-2: 0, # Unsigned Short
|
|
126
|
-
3: 0, # Long
|
|
127
|
-
-3: 0, # Unsigned Long
|
|
128
|
-
4: float('nan'), # Float
|
|
129
|
-
5: float('nan'), # Double,
|
|
130
|
-
6: None, # Null,
|
|
131
|
-
7: 0, # Timestamp
|
|
132
|
-
8: 0, # LongLong
|
|
133
|
-
-8: 0, # Unsigned Longlong
|
|
134
|
-
9: 0, # Int24
|
|
135
|
-
-9: 0, # Unsigned Int24
|
|
136
|
-
10: 0, # Date
|
|
137
|
-
11: 0, # Time
|
|
138
|
-
12: 0, # Datetime
|
|
139
|
-
13: 0, # Year
|
|
140
|
-
15: None, # Varchar
|
|
141
|
-
-15: None, # Varbinary
|
|
142
|
-
16: 0, # Bit
|
|
143
|
-
245: None, # JSON
|
|
144
|
-
246: 0, # NewDecimal
|
|
145
|
-
247: None, # Enum
|
|
146
|
-
248: None, # Set
|
|
147
|
-
249: None, # TinyText
|
|
148
|
-
-249: None, # TinyBlob
|
|
149
|
-
250: None, # MediumText
|
|
150
|
-
-250: None, # MediumBlob
|
|
151
|
-
251: None, # LongText
|
|
152
|
-
-251: None, # LongBlob
|
|
153
|
-
252: None, # Text
|
|
154
|
-
-252: None, # Blob
|
|
155
|
-
253: None, # VarString
|
|
156
|
-
-253: None, # VarBinary
|
|
157
|
-
254: None, # String
|
|
158
|
-
-254: None, # Binary
|
|
159
|
-
255: None, # Geometry
|
|
160
|
-
}
|
|
161
|
-
|
|
162
107
|
PYTHON_CONVERTERS = {
|
|
163
108
|
-1: converters[1],
|
|
164
109
|
-2: converters[2],
|
|
@@ -183,144 +128,6 @@ PYTHON_CONVERTERS = {
|
|
|
183
128
|
PYTHON_CONVERTERS = dict(list(converters.items()) + list(PYTHON_CONVERTERS.items()))
|
|
184
129
|
|
|
185
130
|
|
|
186
|
-
if has_numpy:
|
|
187
|
-
NUMPY_TYPE_MAP = {
|
|
188
|
-
0: object, # Decimal
|
|
189
|
-
1: np.int8, # Tiny
|
|
190
|
-
-1: np.uint8, # Unsigned Tiny
|
|
191
|
-
2: np.int16, # Short
|
|
192
|
-
-2: np.uint16, # Unsigned Short
|
|
193
|
-
3: np.int32, # Long
|
|
194
|
-
-3: np.uint32, # Unsigned Long
|
|
195
|
-
4: np.single, # Float
|
|
196
|
-
5: np.double, # Double,
|
|
197
|
-
6: object, # Null,
|
|
198
|
-
7: object, # Timestamp
|
|
199
|
-
8: np.int64, # LongLong
|
|
200
|
-
-8: np.uint64, # Unsigned LongLong
|
|
201
|
-
9: np.int32, # Int24
|
|
202
|
-
-9: np.uint32, # Unsigned Int24
|
|
203
|
-
10: object, # Date
|
|
204
|
-
11: object, # Time
|
|
205
|
-
12: object, # Datetime
|
|
206
|
-
13: np.int16, # Year
|
|
207
|
-
15: object, # Varchar
|
|
208
|
-
-15: object, # Varbinary
|
|
209
|
-
16: object, # Bit
|
|
210
|
-
245: object, # JSON
|
|
211
|
-
246: object, # NewDecimal
|
|
212
|
-
247: object, # Enum
|
|
213
|
-
248: object, # Set
|
|
214
|
-
249: object, # TinyText
|
|
215
|
-
-249: object, # TinyBlob
|
|
216
|
-
250: object, # MediumText
|
|
217
|
-
-250: object, # MediumBlob
|
|
218
|
-
251: object, # LongText
|
|
219
|
-
-251: object, # LongBlob
|
|
220
|
-
252: object, # Blob
|
|
221
|
-
-252: object, # Text
|
|
222
|
-
253: object, # VarString
|
|
223
|
-
-253: object, # VarBlob
|
|
224
|
-
254: object, # String
|
|
225
|
-
-254: object, # Binary
|
|
226
|
-
255: object, # Geometry
|
|
227
|
-
}
|
|
228
|
-
else:
|
|
229
|
-
NUMPY_TYPE_MAP = {}
|
|
230
|
-
|
|
231
|
-
PANDAS_TYPE_MAP = NUMPY_TYPE_MAP
|
|
232
|
-
|
|
233
|
-
if has_pyarrow:
|
|
234
|
-
PYARROW_TYPE_MAP = {
|
|
235
|
-
0: pa.string(), # Decimal
|
|
236
|
-
1: pa.int8(), # Tiny
|
|
237
|
-
-1: pa.uint8(), # Unsigned Tiny
|
|
238
|
-
2: pa.int16(), # Short
|
|
239
|
-
-2: pa.uint16(), # Unsigned Short
|
|
240
|
-
3: pa.int32(), # Long
|
|
241
|
-
-3: pa.uint32(), # Unsigned Long
|
|
242
|
-
4: pa.float32(), # Float
|
|
243
|
-
5: pa.float64(), # Double,
|
|
244
|
-
6: pa.null(), # Null,
|
|
245
|
-
7: pa.timestamp('ns'), # Timestamp
|
|
246
|
-
8: pa.int64(), # LongLong
|
|
247
|
-
-8: pa.uint64(), # Unsigned LongLong
|
|
248
|
-
9: pa.int32(), # Int24
|
|
249
|
-
-9: pa.uint32(), # Unsigned Int24
|
|
250
|
-
10: pa.date64(), # Date
|
|
251
|
-
11: pa.duration('ns'), # Time
|
|
252
|
-
12: pa.timestamp('ns'), # Datetime
|
|
253
|
-
13: pa.int16(), # Year
|
|
254
|
-
15: pa.string(), # Varchar
|
|
255
|
-
-15: pa.binary(), # Varbinary
|
|
256
|
-
16: pa.binary(), # Bit
|
|
257
|
-
245: pa.string(), # JSON
|
|
258
|
-
246: pa.string(), # NewDecimal
|
|
259
|
-
247: pa.string(), # Enum
|
|
260
|
-
248: pa.string(), # Set
|
|
261
|
-
249: pa.string(), # TinyText
|
|
262
|
-
-249: pa.binary(), # TinyBlob
|
|
263
|
-
250: pa.string(), # MediumText
|
|
264
|
-
-250: pa.binary(), # MediumBlob
|
|
265
|
-
251: pa.string(), # LongText
|
|
266
|
-
-251: pa.binary(), # LongBlob
|
|
267
|
-
252: pa.string(), # Text
|
|
268
|
-
-252: pa.binary(), # Blob
|
|
269
|
-
253: pa.string(), # VarString
|
|
270
|
-
-253: pa.binary(), # VarBinary
|
|
271
|
-
254: pa.string(), # String
|
|
272
|
-
-254: pa.binary(), # Binary
|
|
273
|
-
255: pa.string(), # Geometry
|
|
274
|
-
}
|
|
275
|
-
else:
|
|
276
|
-
PYARROW_TYPE_MAP = {}
|
|
277
|
-
|
|
278
|
-
if has_polars:
|
|
279
|
-
POLARS_TYPE_MAP = {
|
|
280
|
-
0: pl.Utf8, # Decimal
|
|
281
|
-
1: pl.Int8, # Tiny
|
|
282
|
-
-1: pl.UInt8, # Unsigned Tiny
|
|
283
|
-
2: pl.Int16, # Short
|
|
284
|
-
-2: pl.UInt16, # Unsigned Short
|
|
285
|
-
3: pl.Int32, # Long
|
|
286
|
-
-3: pl.UInt32, # Unsigned Long
|
|
287
|
-
4: pl.Float32, # Float
|
|
288
|
-
5: pl.Float64, # Double,
|
|
289
|
-
6: pl.Null, # Null,
|
|
290
|
-
7: pl.Datetime, # Timestamp
|
|
291
|
-
8: pl.Int64, # LongLong
|
|
292
|
-
-8: pl.UInt64, # Unsigned LongLong
|
|
293
|
-
9: pl.Int32, # Int24
|
|
294
|
-
-9: pl.UInt32, # Unsigned Int24
|
|
295
|
-
10: pl.Date, # Date
|
|
296
|
-
11: pl.Time, # Time
|
|
297
|
-
12: pl.Datetime, # Datetime
|
|
298
|
-
13: pl.Int16, # Year
|
|
299
|
-
15: pl.Utf8, # Varchar
|
|
300
|
-
-15: pl.Utf8, # Varbinary
|
|
301
|
-
16: pl.Binary, # Bit
|
|
302
|
-
245: pl.Utf8, # JSON
|
|
303
|
-
246: pl.Utf8, # NewDecimal
|
|
304
|
-
247: pl.Utf8, # Enum
|
|
305
|
-
248: pl.Utf8, # Set
|
|
306
|
-
249: pl.Utf8, # TinyText
|
|
307
|
-
-249: pl.Utf8, # TinyBlob
|
|
308
|
-
250: pl.Utf8, # MediumBlob
|
|
309
|
-
-250: pl.Utf8, # MediumText
|
|
310
|
-
251: pl.Utf8, # LongBlob
|
|
311
|
-
-251: pl.Utf8, # LongText
|
|
312
|
-
252: pl.Utf8, # Blob
|
|
313
|
-
-252: pl.Utf8, # Text
|
|
314
|
-
253: pl.Utf8, # VarString
|
|
315
|
-
-253: pl.Utf8, # VarBinary
|
|
316
|
-
254: pl.Utf8, # String
|
|
317
|
-
-254: pl.Utf8, # Binary
|
|
318
|
-
255: pl.Utf8, # Geometry
|
|
319
|
-
}
|
|
320
|
-
else:
|
|
321
|
-
POLARS_TYPE_MAP = {}
|
|
322
|
-
|
|
323
|
-
|
|
324
131
|
def _modifiers(
|
|
325
132
|
*,
|
|
326
133
|
nullable: Optional[bool] = None,
|