singlestoredb 1.0.4__cp38-abi3-win32.whl → 1.1.0__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.0.4'
16
+ __version__ = '1.1.0'
17
17
 
18
18
  from typing import Any
19
19
 
singlestoredb/config.py CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  """SingleStoreDB package options."""
3
3
  import functools
4
+ import os
4
5
 
5
6
  from . import auth
6
7
  from .utils.config import check_bool # noqa: F401
@@ -230,6 +231,7 @@ register_option(
230
231
  valid_values=[
231
232
  'tuple', 'tuples', 'namedtuple', 'namedtuples',
232
233
  'dict', 'dicts', 'structsequence', 'structsequences',
234
+ 'numpy', 'pandas', 'polars', 'arrow', 'pyarrow',
233
235
  ],
234
236
  ),
235
237
  'tuples',
@@ -266,6 +268,129 @@ register_option(
266
268
  )
267
269
 
268
270
 
271
+ #
272
+ # External function options
273
+ #
274
+ register_option(
275
+ 'external_function.url', 'string', check_str, 'http://localhost:8000/invoke',
276
+ 'Specifies the URL of the external function application.',
277
+ environ=['SINGLESTOREDB_EXT_FUNC_URL'],
278
+ )
279
+
280
+ register_option(
281
+ 'external_function.app_mode', 'string',
282
+ functools.partial(
283
+ check_str,
284
+ valid_values=['remote', 'collocated'],
285
+ ),
286
+ 'remote',
287
+ 'Specifies the mode of operation of the external function application.',
288
+ environ=['SINGLESTOREDB_EXT_FUNC_APP_MODE'],
289
+ )
290
+
291
+ register_option(
292
+ 'external_function.data_format', 'string',
293
+ functools.partial(
294
+ check_str,
295
+ valid_values=['rowdat_1', 'json'],
296
+ ),
297
+ 'rowdat_1',
298
+ 'Specifies the format for the data rows.',
299
+ environ=['SINGLESTOREDB_EXT_FUNC_DATA_FORMAT'],
300
+ )
301
+
302
+ register_option(
303
+ 'external_function.data_version', 'string', check_str, '1.0',
304
+ 'Specifies the version of the data format.',
305
+ environ=['SINGLESTOREDB_EXT_FUNC_DATA_VERSION'],
306
+ )
307
+
308
+ register_option(
309
+ 'external_function.link_name', 'string', check_str, None,
310
+ 'Specifies the link name to use for remote external functions.',
311
+ environ=['SINGLESTOREDB_EXT_FUNC_LINK_NAME'],
312
+ )
313
+
314
+ register_option(
315
+ 'external_function.link_config', 'string', check_str, None,
316
+ 'Specifies the link config in JSON format.',
317
+ environ=['SINGLESTOREDB_EXT_FUNC_LINK_CONFIG'],
318
+ )
319
+
320
+ register_option(
321
+ 'external_function.link_credentials', 'string', check_str, None,
322
+ 'Specifies the link credentials in JSON format.',
323
+ environ=['SINGLESTOREDB_EXT_FUNC_LINK_CREDENTIALS'],
324
+ )
325
+
326
+ register_option(
327
+ 'external_function.replace_existing', 'bool', check_bool, False,
328
+ 'Should existing functions be replaced when registering external functions?',
329
+ environ=['SINGLESTOREDB_EXT_FUNC_REPLACE_EXISTING'],
330
+ )
331
+
332
+ register_option(
333
+ 'external_function.socket_path', 'string', check_str, None,
334
+ 'Specifies the socket path for collocated external functions.',
335
+ environ=['SINGLESTOREDB_EXT_FUNC_SOCKET_PATH'],
336
+ )
337
+
338
+ register_option(
339
+ 'external_function.max_connections', 'int', check_int, 32,
340
+ 'Specifies the maximum connections in a collocated external function ' +
341
+ 'before reusing them.',
342
+ environ=['SINGLESTOREDB_EXT_FUNC_MAX_CONNECTIONS'],
343
+ )
344
+
345
+ register_option(
346
+ 'external_function.process_mode', 'string',
347
+ functools.partial(
348
+ check_str,
349
+ valid_values=['thread', 'subprocess'],
350
+ ),
351
+ 'subprocess',
352
+ 'Specifies the method to use for concurrent handlers in ' +
353
+ 'collocated external functions',
354
+ environ=['SINGLESTOREDB_EXT_FUNC_PROCESS_MODE'],
355
+ )
356
+
357
+ register_option(
358
+ 'external_function.single_thread', 'bool', check_bool, False,
359
+ 'Should the collocated server run in single-thread mode?',
360
+ environ=['SINGLESTOREDB_EXT_FUNC_SINGLE_THREAD'],
361
+ )
362
+
363
+ register_option(
364
+ 'external_function.log_level', 'string',
365
+ functools.partial(
366
+ check_str,
367
+ valid_values=['info', 'debug', 'warning', 'error'],
368
+ ),
369
+ 'info',
370
+ 'Logging level of external function server.',
371
+ environ=['SINGLESTOREDB_EXT_FUNC_LOG_LEVEL'],
372
+ )
373
+
374
+ register_option(
375
+ 'external_function.connection', 'string', check_str,
376
+ os.environ.get('SINGLESTOREDB_URL') or None,
377
+ 'Specifies the connection string for the database to register functions with.',
378
+ environ=['SINGLESTOREDB_EXT_FUNC_CONNECTION'],
379
+ )
380
+
381
+ register_option(
382
+ 'external_function.host', 'string', check_str, '127.0.0.1',
383
+ 'Specifies the host to bind the server to.',
384
+ environ=['SINGLESTOREDB_EXT_FUNC_HOST'],
385
+ )
386
+
387
+ register_option(
388
+ 'external_function.port', 'int', check_int, 8000,
389
+ 'Specifies the port to bind the server to.',
390
+ environ=['SINGLESTOREDB_EXT_FUNC_PORT'],
391
+ )
392
+
393
+
269
394
  #
270
395
  # Debugging options
271
396
  #
@@ -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
- try:
15
- import numpy as np
16
- has_numpy = True
17
- except ImportError:
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,
@@ -1,2 +1 @@
1
1
  #!/usr/bin/env python3
2
- from .asgi import create_app # noqa: F401