singlestoredb 1.0.3__py3-none-any.whl → 1.1.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 +125 -0
- singlestoredb/functions/dtypes.py +5 -198
- singlestoredb/functions/ext/__init__.py +0 -1
- singlestoredb/functions/ext/asgi.py +665 -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 +109 -9
- singlestoredb/fusion/handlers/stage.py +150 -0
- singlestoredb/fusion/handlers/workspace.py +265 -4
- singlestoredb/fusion/registry.py +69 -1
- singlestoredb/http/connection.py +40 -2
- singlestoredb/management/utils.py +30 -0
- singlestoredb/management/workspace.py +209 -35
- singlestoredb/mysql/connection.py +69 -0
- singlestoredb/mysql/cursors.py +176 -4
- singlestoredb/tests/test.sql +210 -0
- singlestoredb/tests/test_connection.py +1408 -0
- 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.3.dist-info → singlestoredb-1.1.0.dist-info}/METADATA +2 -1
- {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/RECORD +30 -28
- {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/LICENSE +0 -0
- {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/WHEEL +0 -0
- {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,7 @@ import singlestoredb as s2
|
|
|
13
13
|
import singlestoredb.mysql.constants.FIELD_TYPE as ft
|
|
14
14
|
from . import ext_funcs
|
|
15
15
|
from . import utils
|
|
16
|
-
from singlestoredb.functions.ext import create_app
|
|
16
|
+
from singlestoredb.functions.ext.asgi import create_app
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
try:
|
|
@@ -41,7 +41,7 @@ def start_http_server(database, data_format='rowdat_1'):
|
|
|
41
41
|
port = get_open_port()
|
|
42
42
|
print(f'Start UDF HTTP server on http://{HTTP_HOST}:{port}')
|
|
43
43
|
proc = subprocess.Popen(
|
|
44
|
-
['uvicorn', 'singlestoredb.functions.ext:create_app'],
|
|
44
|
+
['uvicorn', 'singlestoredb.functions.ext.asgi:create_app'],
|
|
45
45
|
env=dict(
|
|
46
46
|
PATH=os.environ['PATH'],
|
|
47
47
|
PYTHONPATH=os.environ.get('PYTHONPATH', ''),
|
|
@@ -115,7 +115,7 @@ polars_unsigned_int24_arr = \
|
|
|
115
115
|
polars_string_arr = \
|
|
116
116
|
pl.Series(None, numpy_string_arr.tolist(), dtype=pl.Utf8)
|
|
117
117
|
polars_binary_arr = \
|
|
118
|
-
pl.Series(None, numpy_binary_arr.tolist(), dtype=pl.
|
|
118
|
+
pl.Series(None, numpy_binary_arr.tolist(), dtype=pl.Binary)
|
|
119
119
|
|
|
120
120
|
polars_data = [
|
|
121
121
|
(polars_tiny_arr, polars_nulls),
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
import numpy as np
|
|
5
|
+
has_numpy = True
|
|
6
|
+
except ImportError:
|
|
7
|
+
has_numpy = False
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import polars as pl
|
|
11
|
+
has_polars = True
|
|
12
|
+
except ImportError:
|
|
13
|
+
has_polars = False
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
import pyarrow as pa
|
|
17
|
+
has_pyarrow = True
|
|
18
|
+
except ImportError:
|
|
19
|
+
has_pyarrow = False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
DEFAULT_VALUES = {
|
|
23
|
+
0: 0, # Decimal
|
|
24
|
+
1: 0, # Tiny
|
|
25
|
+
-1: 0, # Unsigned Tiny
|
|
26
|
+
2: 0, # Short
|
|
27
|
+
-2: 0, # Unsigned Short
|
|
28
|
+
3: 0, # Long
|
|
29
|
+
-3: 0, # Unsigned Long
|
|
30
|
+
4: float('nan'), # Float
|
|
31
|
+
5: float('nan'), # Double,
|
|
32
|
+
6: None, # Null,
|
|
33
|
+
7: 0, # Timestamp
|
|
34
|
+
8: 0, # LongLong
|
|
35
|
+
-8: 0, # Unsigned Longlong
|
|
36
|
+
9: 0, # Int24
|
|
37
|
+
-9: 0, # Unsigned Int24
|
|
38
|
+
10: 0, # Date
|
|
39
|
+
-10: 0, # Date
|
|
40
|
+
11: 0, # Time
|
|
41
|
+
12: 0, # Datetime
|
|
42
|
+
13: 0, # Year
|
|
43
|
+
15: None, # Varchar
|
|
44
|
+
-15: None, # Varbinary
|
|
45
|
+
16: 0, # Bit
|
|
46
|
+
245: None, # JSON
|
|
47
|
+
246: 0, # NewDecimal
|
|
48
|
+
-246: 0, # NewDecimal
|
|
49
|
+
247: None, # Enum
|
|
50
|
+
248: None, # Set
|
|
51
|
+
249: None, # TinyText
|
|
52
|
+
-249: None, # TinyBlob
|
|
53
|
+
250: None, # MediumText
|
|
54
|
+
-250: None, # MediumBlob
|
|
55
|
+
251: None, # LongText
|
|
56
|
+
-251: None, # LongBlob
|
|
57
|
+
252: None, # Text
|
|
58
|
+
-252: None, # Blob
|
|
59
|
+
253: None, # VarString
|
|
60
|
+
-253: None, # VarBinary
|
|
61
|
+
254: None, # String
|
|
62
|
+
-254: None, # Binary
|
|
63
|
+
255: None, # Geometry
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if has_numpy:
|
|
68
|
+
NUMPY_TYPE_MAP = {
|
|
69
|
+
0: object, # Decimal
|
|
70
|
+
1: np.int8, # Tiny
|
|
71
|
+
-1: np.uint8, # Unsigned Tiny
|
|
72
|
+
2: np.int16, # Short
|
|
73
|
+
-2: np.uint16, # Unsigned Short
|
|
74
|
+
3: np.int32, # Long
|
|
75
|
+
-3: np.uint32, # Unsigned Long
|
|
76
|
+
4: np.single, # Float
|
|
77
|
+
5: np.double, # Double,
|
|
78
|
+
6: object, # Null,
|
|
79
|
+
7: np.dtype('datetime64[us]'), # Timestamp
|
|
80
|
+
8: np.int64, # LongLong
|
|
81
|
+
-8: np.uint64, # Unsigned LongLong
|
|
82
|
+
9: np.int32, # Int24
|
|
83
|
+
-9: np.uint32, # Unsigned Int24
|
|
84
|
+
10: np.dtype('datetime64[D]'), # Date
|
|
85
|
+
11: np.dtype('timedelta64[us]'), # Time
|
|
86
|
+
12: np.dtype('datetime64[us]'), # Datetime
|
|
87
|
+
13: np.int16, # Year
|
|
88
|
+
15: object, # Varchar
|
|
89
|
+
-15: object, # Varbinary
|
|
90
|
+
16: object, # Bit
|
|
91
|
+
245: object, # JSON
|
|
92
|
+
246: object, # NewDecimal
|
|
93
|
+
-246: object, # NewDecimal
|
|
94
|
+
247: object, # Enum
|
|
95
|
+
248: object, # Set
|
|
96
|
+
249: object, # TinyText
|
|
97
|
+
-249: object, # TinyBlob
|
|
98
|
+
250: object, # MediumText
|
|
99
|
+
-250: object, # MediumBlob
|
|
100
|
+
251: object, # LongText
|
|
101
|
+
-251: object, # LongBlob
|
|
102
|
+
252: object, # Blob
|
|
103
|
+
-252: object, # Text
|
|
104
|
+
253: object, # VarString
|
|
105
|
+
-253: object, # VarBlob
|
|
106
|
+
254: object, # String
|
|
107
|
+
-254: object, # Binary
|
|
108
|
+
255: object, # Geometry
|
|
109
|
+
}
|
|
110
|
+
else:
|
|
111
|
+
NUMPY_TYPE_MAP = {}
|
|
112
|
+
|
|
113
|
+
PANDAS_TYPE_MAP = NUMPY_TYPE_MAP
|
|
114
|
+
|
|
115
|
+
if has_pyarrow:
|
|
116
|
+
PYARROW_TYPE_MAP = {
|
|
117
|
+
0: pa.decimal128(18, 6), # Decimal
|
|
118
|
+
1: pa.int8(), # Tiny
|
|
119
|
+
-1: pa.uint8(), # Unsigned Tiny
|
|
120
|
+
2: pa.int16(), # Short
|
|
121
|
+
-2: pa.uint16(), # Unsigned Short
|
|
122
|
+
3: pa.int32(), # Long
|
|
123
|
+
-3: pa.uint32(), # Unsigned Long
|
|
124
|
+
4: pa.float32(), # Float
|
|
125
|
+
5: pa.float64(), # Double,
|
|
126
|
+
6: pa.null(), # Null,
|
|
127
|
+
7: pa.timestamp('us'), # Timestamp
|
|
128
|
+
8: pa.int64(), # LongLong
|
|
129
|
+
-8: pa.uint64(), # Unsigned LongLong
|
|
130
|
+
9: pa.int32(), # Int24
|
|
131
|
+
-9: pa.uint32(), # Unsigned Int24
|
|
132
|
+
10: pa.date64(), # Date
|
|
133
|
+
11: pa.duration('us'), # Time
|
|
134
|
+
12: pa.timestamp('us'), # Datetime
|
|
135
|
+
13: pa.int16(), # Year
|
|
136
|
+
15: pa.string(), # Varchar
|
|
137
|
+
-15: pa.binary(), # Varbinary
|
|
138
|
+
16: pa.binary(), # Bit
|
|
139
|
+
245: pa.string(), # JSON
|
|
140
|
+
246: pa.decimal128(18, 6), # NewDecimal
|
|
141
|
+
-246: pa.decimal128(18, 6), # NewDecimal
|
|
142
|
+
247: pa.string(), # Enum
|
|
143
|
+
248: pa.string(), # Set
|
|
144
|
+
249: pa.string(), # TinyText
|
|
145
|
+
-249: pa.binary(), # TinyBlob
|
|
146
|
+
250: pa.string(), # MediumText
|
|
147
|
+
-250: pa.binary(), # MediumBlob
|
|
148
|
+
251: pa.string(), # LongText
|
|
149
|
+
-251: pa.binary(), # LongBlob
|
|
150
|
+
252: pa.string(), # Text
|
|
151
|
+
-252: pa.binary(), # Blob
|
|
152
|
+
253: pa.string(), # VarString
|
|
153
|
+
-253: pa.binary(), # VarBinary
|
|
154
|
+
254: pa.string(), # String
|
|
155
|
+
-254: pa.binary(), # Binary
|
|
156
|
+
255: pa.string(), # Geometry
|
|
157
|
+
}
|
|
158
|
+
else:
|
|
159
|
+
PYARROW_TYPE_MAP = {}
|
|
160
|
+
|
|
161
|
+
if has_polars:
|
|
162
|
+
POLARS_TYPE_MAP = {
|
|
163
|
+
0: pl.Decimal(10, 6), # Decimal
|
|
164
|
+
1: pl.Int8, # Tiny
|
|
165
|
+
-1: pl.UInt8, # Unsigned Tiny
|
|
166
|
+
2: pl.Int16, # Short
|
|
167
|
+
-2: pl.UInt16, # Unsigned Short
|
|
168
|
+
3: pl.Int32, # Long
|
|
169
|
+
-3: pl.UInt32, # Unsigned Long
|
|
170
|
+
4: pl.Float32, # Float
|
|
171
|
+
5: pl.Float64, # Double,
|
|
172
|
+
6: pl.Null, # Null,
|
|
173
|
+
7: pl.Datetime, # Timestamp
|
|
174
|
+
8: pl.Int64, # LongLong
|
|
175
|
+
-8: pl.UInt64, # Unsigned LongLong
|
|
176
|
+
9: pl.Int32, # Int24
|
|
177
|
+
-9: pl.UInt32, # Unsigned Int24
|
|
178
|
+
10: pl.Date, # Date
|
|
179
|
+
11: pl.Duration, # Time
|
|
180
|
+
12: pl.Datetime, # Datetime
|
|
181
|
+
13: pl.Int16, # Year
|
|
182
|
+
15: pl.Utf8, # Varchar
|
|
183
|
+
-15: pl.Utf8, # Varbinary
|
|
184
|
+
16: pl.Binary, # Bit
|
|
185
|
+
245: pl.Object, # JSON
|
|
186
|
+
246: pl.Decimal(10, 6), # NewDecimal
|
|
187
|
+
-246: pl.Decimal(10, 6), # NewDecimal
|
|
188
|
+
247: pl.Utf8, # Enum
|
|
189
|
+
248: pl.Utf8, # Set
|
|
190
|
+
249: pl.Utf8, # TinyText
|
|
191
|
+
-249: pl.Binary, # TinyBlob
|
|
192
|
+
250: pl.Utf8, # MediumBlob
|
|
193
|
+
-250: pl.Binary, # MediumText
|
|
194
|
+
251: pl.Utf8, # LongBlob
|
|
195
|
+
-251: pl.Binary, # LongText
|
|
196
|
+
252: pl.Utf8, # Blob
|
|
197
|
+
-252: pl.Binary, # Text
|
|
198
|
+
253: pl.Utf8, # VarString
|
|
199
|
+
-253: pl.Binary, # VarBinary
|
|
200
|
+
254: pl.Utf8, # String
|
|
201
|
+
-254: pl.Binary, # Binary
|
|
202
|
+
255: pl.Utf8, # Geometry
|
|
203
|
+
}
|
|
204
|
+
else:
|
|
205
|
+
POLARS_TYPE_MAP = {}
|