singlestoredb 0.4.0__py3-none-any.whl → 1.0.4__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.

Files changed (120) hide show
  1. singlestoredb/__init__.py +33 -1
  2. singlestoredb/alchemy/__init__.py +90 -0
  3. singlestoredb/auth.py +5 -1
  4. singlestoredb/config.py +116 -14
  5. singlestoredb/connection.py +483 -516
  6. singlestoredb/converters.py +238 -135
  7. singlestoredb/exceptions.py +30 -2
  8. singlestoredb/functions/__init__.py +1 -0
  9. singlestoredb/functions/decorator.py +142 -0
  10. singlestoredb/functions/dtypes.py +1639 -0
  11. singlestoredb/functions/ext/__init__.py +2 -0
  12. singlestoredb/functions/ext/arrow.py +375 -0
  13. singlestoredb/functions/ext/asgi.py +661 -0
  14. singlestoredb/functions/ext/json.py +427 -0
  15. singlestoredb/functions/ext/mmap.py +306 -0
  16. singlestoredb/functions/ext/rowdat_1.py +744 -0
  17. singlestoredb/functions/signature.py +673 -0
  18. singlestoredb/fusion/__init__.py +11 -0
  19. singlestoredb/fusion/graphql.py +213 -0
  20. singlestoredb/fusion/handler.py +621 -0
  21. singlestoredb/fusion/handlers/stage.py +257 -0
  22. singlestoredb/fusion/handlers/utils.py +162 -0
  23. singlestoredb/fusion/handlers/workspace.py +412 -0
  24. singlestoredb/fusion/registry.py +164 -0
  25. singlestoredb/fusion/result.py +399 -0
  26. singlestoredb/http/__init__.py +27 -0
  27. singlestoredb/{http.py → http/connection.py} +555 -154
  28. singlestoredb/management/__init__.py +3 -0
  29. singlestoredb/management/billing_usage.py +148 -0
  30. singlestoredb/management/cluster.py +14 -6
  31. singlestoredb/management/manager.py +100 -38
  32. singlestoredb/management/organization.py +188 -0
  33. singlestoredb/management/region.py +5 -5
  34. singlestoredb/management/utils.py +281 -2
  35. singlestoredb/management/workspace.py +1344 -49
  36. singlestoredb/{clients/pymysqlsv → mysql}/__init__.py +16 -21
  37. singlestoredb/{clients/pymysqlsv → mysql}/_auth.py +39 -8
  38. singlestoredb/{clients/pymysqlsv → mysql}/charset.py +26 -23
  39. singlestoredb/{clients/pymysqlsv/connections.py → mysql/connection.py} +532 -165
  40. singlestoredb/{clients/pymysqlsv → mysql}/constants/CLIENT.py +0 -1
  41. singlestoredb/{clients/pymysqlsv → mysql}/constants/COMMAND.py +0 -1
  42. singlestoredb/{clients/pymysqlsv → mysql}/constants/CR.py +0 -2
  43. singlestoredb/{clients/pymysqlsv → mysql}/constants/ER.py +0 -1
  44. singlestoredb/{clients/pymysqlsv → mysql}/constants/FIELD_TYPE.py +1 -1
  45. singlestoredb/{clients/pymysqlsv → mysql}/constants/FLAG.py +0 -1
  46. singlestoredb/{clients/pymysqlsv → mysql}/constants/SERVER_STATUS.py +0 -1
  47. singlestoredb/mysql/converters.py +271 -0
  48. singlestoredb/{clients/pymysqlsv → mysql}/cursors.py +228 -112
  49. singlestoredb/mysql/err.py +92 -0
  50. singlestoredb/{clients/pymysqlsv → mysql}/optionfile.py +5 -4
  51. singlestoredb/{clients/pymysqlsv → mysql}/protocol.py +49 -20
  52. singlestoredb/mysql/tests/__init__.py +19 -0
  53. singlestoredb/{clients/pymysqlsv → mysql}/tests/base.py +32 -12
  54. singlestoredb/mysql/tests/conftest.py +37 -0
  55. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_DictCursor.py +11 -7
  56. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_SSCursor.py +17 -12
  57. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_basic.py +32 -24
  58. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_connection.py +130 -119
  59. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_converters.py +9 -7
  60. singlestoredb/mysql/tests/test_cursor.py +141 -0
  61. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_err.py +3 -2
  62. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_issues.py +35 -27
  63. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_load_local.py +13 -11
  64. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_nextset.py +7 -3
  65. singlestoredb/{clients/pymysqlsv → mysql}/tests/test_optionfile.py +2 -1
  66. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/__init__.py +1 -1
  67. singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +9 -0
  68. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/test_MySQLdb/capabilities.py +19 -17
  69. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/test_MySQLdb/dbapi20.py +31 -22
  70. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +3 -4
  71. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +24 -20
  72. singlestoredb/{clients/pymysqlsv → mysql}/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +4 -4
  73. singlestoredb/{clients/pymysqlsv → mysql}/times.py +3 -4
  74. singlestoredb/pytest.py +283 -0
  75. singlestoredb/tests/empty.sql +0 -0
  76. singlestoredb/tests/ext_funcs/__init__.py +385 -0
  77. singlestoredb/tests/test.sql +210 -0
  78. singlestoredb/tests/test2.sql +1 -0
  79. singlestoredb/tests/test_basics.py +482 -115
  80. singlestoredb/tests/test_config.py +13 -13
  81. singlestoredb/tests/test_connection.py +241 -305
  82. singlestoredb/tests/test_dbapi.py +27 -0
  83. singlestoredb/tests/test_ext_func.py +1193 -0
  84. singlestoredb/tests/test_ext_func_data.py +1101 -0
  85. singlestoredb/tests/test_fusion.py +465 -0
  86. singlestoredb/tests/test_http.py +32 -26
  87. singlestoredb/tests/test_management.py +588 -8
  88. singlestoredb/tests/test_plugin.py +33 -0
  89. singlestoredb/tests/test_results.py +11 -12
  90. singlestoredb/tests/test_udf.py +687 -0
  91. singlestoredb/tests/utils.py +3 -2
  92. singlestoredb/utils/config.py +58 -0
  93. singlestoredb/utils/debug.py +13 -0
  94. singlestoredb/utils/mogrify.py +151 -0
  95. singlestoredb/utils/results.py +4 -1
  96. singlestoredb-1.0.4.dist-info/METADATA +139 -0
  97. singlestoredb-1.0.4.dist-info/RECORD +112 -0
  98. {singlestoredb-0.4.0.dist-info → singlestoredb-1.0.4.dist-info}/WHEEL +1 -1
  99. singlestoredb-1.0.4.dist-info/entry_points.txt +2 -0
  100. singlestoredb/clients/pymysqlsv/converters.py +0 -365
  101. singlestoredb/clients/pymysqlsv/err.py +0 -144
  102. singlestoredb/clients/pymysqlsv/tests/__init__.py +0 -19
  103. singlestoredb/clients/pymysqlsv/tests/test_cursor.py +0 -133
  104. singlestoredb/clients/pymysqlsv/tests/thirdparty/test_MySQLdb/__init__.py +0 -9
  105. singlestoredb/drivers/__init__.py +0 -45
  106. singlestoredb/drivers/base.py +0 -198
  107. singlestoredb/drivers/cymysql.py +0 -38
  108. singlestoredb/drivers/http.py +0 -47
  109. singlestoredb/drivers/mariadb.py +0 -40
  110. singlestoredb/drivers/mysqlconnector.py +0 -49
  111. singlestoredb/drivers/mysqldb.py +0 -60
  112. singlestoredb/drivers/pymysql.py +0 -37
  113. singlestoredb/drivers/pymysqlsv.py +0 -35
  114. singlestoredb/drivers/pyodbc.py +0 -65
  115. singlestoredb-0.4.0.dist-info/METADATA +0 -111
  116. singlestoredb-0.4.0.dist-info/RECORD +0 -86
  117. /singlestoredb/{clients → fusion/handlers}/__init__.py +0 -0
  118. /singlestoredb/{clients/pymysqlsv → mysql}/constants/__init__.py +0 -0
  119. {singlestoredb-0.4.0.dist-info → singlestoredb-1.0.4.dist-info}/LICENSE +0 -0
  120. {singlestoredb-0.4.0.dist-info → singlestoredb-1.0.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,385 @@
1
+ #!/usr/bin/env python3
2
+ # type: ignore
3
+ from typing import Optional
4
+ from typing import Tuple
5
+
6
+ from singlestoredb.functions.decorator import udf
7
+ from singlestoredb.functions.dtypes import BIGINT
8
+ from singlestoredb.functions.dtypes import FLOAT
9
+ from singlestoredb.functions.dtypes import MEDIUMINT
10
+ from singlestoredb.functions.dtypes import SMALLINT
11
+ from singlestoredb.functions.dtypes import TINYINT
12
+ from singlestoredb.functions.dtypes import VARCHAR
13
+
14
+
15
+ @udf
16
+ def double_mult(x: float, y: float) -> float:
17
+ return x * y
18
+
19
+
20
+ @udf.pandas
21
+ def pandas_double_mult(x: float, y: float) -> float:
22
+ return x * y
23
+
24
+
25
+ @udf.numpy
26
+ def numpy_double_mult(x: float, y: float) -> float:
27
+ return x * y
28
+
29
+
30
+ @udf.arrow
31
+ def arrow_double_mult(x: float, y: float) -> float:
32
+ import pyarrow.compute as pc
33
+ return pc.multiply(x, y)
34
+
35
+
36
+ @udf.polars
37
+ def polars_double_mult(x: float, y: float) -> float:
38
+ return x * y
39
+
40
+
41
+ @udf
42
+ def nullable_double_mult(x: Optional[float], y: Optional[float]) -> Optional[float]:
43
+ if x is None or y is None:
44
+ return None
45
+ return x * y
46
+
47
+
48
+ @udf(args=[FLOAT(nullable=False), FLOAT(nullable=False)], returns=FLOAT(nullable=False))
49
+ def float_mult(x: float, y: float) -> float:
50
+ return x * y
51
+
52
+
53
+ @udf(args=[FLOAT(nullable=True), FLOAT(nullable=True)], returns=FLOAT(nullable=True))
54
+ def nullable_float_mult(x: Optional[float], y: Optional[float]) -> Optional[float]:
55
+ if x is None or y is None:
56
+ return None
57
+ return x * y
58
+
59
+
60
+ def _int_mult(x: int, y: int) -> int:
61
+ if x is None or y is None:
62
+ return None
63
+ return x * y
64
+
65
+
66
+ def _arrow_int_mult(x: int, y: int) -> int:
67
+ import pyarrow.compute as pc
68
+ return pc.multiply(x, y)
69
+
70
+
71
+ def _int_mult_with_masks(x: Tuple[int, bool], y: Tuple[int, bool]) -> Tuple[int, bool]:
72
+ x_data, x_nulls = x
73
+ y_data, y_nulls = y
74
+ return (x_data * y_data, x_nulls | y_nulls)
75
+
76
+
77
+ def _arrow_int_mult_with_masks(
78
+ x: Tuple[int, bool],
79
+ y: Tuple[int, bool],
80
+ ) -> Tuple[int, bool]:
81
+ import pyarrow.compute as pc
82
+ x_data, x_nulls = x
83
+ y_data, y_nulls = y
84
+ return (pc.multiply(x_data, y_data), pc.or_(x_nulls, y_nulls))
85
+
86
+
87
+ int_mult = udf(_int_mult, name='int_mult')
88
+
89
+ tinyint_mult = udf(
90
+ _int_mult,
91
+ name='tinyint_mult',
92
+ args=[TINYINT(nullable=False), TINYINT(nullable=False)],
93
+ returns=TINYINT(nullable=False),
94
+ )
95
+
96
+ pandas_tinyint_mult = udf.pandas(
97
+ _int_mult,
98
+ name='pandas_tinyint_mult',
99
+ args=[TINYINT(nullable=False), TINYINT(nullable=False)],
100
+ returns=TINYINT(nullable=False),
101
+ )
102
+
103
+ polars_tinyint_mult = udf.polars(
104
+ _int_mult,
105
+ name='polars_tinyint_mult',
106
+ args=[TINYINT(nullable=False), TINYINT(nullable=False)],
107
+ returns=TINYINT(nullable=False),
108
+ )
109
+
110
+ numpy_tinyint_mult = udf.numpy(
111
+ _int_mult,
112
+ name='numpy_tinyint_mult',
113
+ args=[TINYINT(nullable=False), TINYINT(nullable=False)],
114
+ returns=TINYINT(nullable=False),
115
+ )
116
+
117
+ arrow_tinyint_mult = udf.arrow(
118
+ _arrow_int_mult,
119
+ name='arrow_tinyint_mult',
120
+ args=[TINYINT(nullable=False), TINYINT(nullable=False)],
121
+ returns=TINYINT(nullable=False),
122
+ )
123
+
124
+ smallint_mult = udf(
125
+ _int_mult,
126
+ name='smallint_mult',
127
+ args=[SMALLINT(nullable=False), SMALLINT(nullable=False)],
128
+ returns=SMALLINT(nullable=False),
129
+ )
130
+
131
+ pandas_smallint_mult = udf.pandas(
132
+ _int_mult,
133
+ name='pandas_smallint_mult',
134
+ args=[SMALLINT(nullable=False), SMALLINT(nullable=False)],
135
+ returns=SMALLINT(nullable=False),
136
+ )
137
+
138
+ polars_smallint_mult = udf.polars(
139
+ _int_mult,
140
+ name='polars_smallint_mult',
141
+ args=[SMALLINT(nullable=False), SMALLINT(nullable=False)],
142
+ returns=SMALLINT(nullable=False),
143
+ )
144
+
145
+ numpy_smallint_mult = udf.numpy(
146
+ _int_mult,
147
+ name='numpy_smallint_mult',
148
+ args=[SMALLINT(nullable=False), SMALLINT(nullable=False)],
149
+ returns=SMALLINT(nullable=False),
150
+ )
151
+
152
+ arrow_smallint_mult = udf.arrow(
153
+ _arrow_int_mult,
154
+ name='arrow_smallint_mult',
155
+ args=[SMALLINT(nullable=False), SMALLINT(nullable=False)],
156
+ returns=SMALLINT(nullable=False),
157
+ )
158
+
159
+ mediumint_mult = udf(
160
+ _int_mult,
161
+ name='mediumint_mult',
162
+ args=[MEDIUMINT(nullable=False), MEDIUMINT(nullable=False)],
163
+ returns=MEDIUMINT(nullable=False),
164
+ )
165
+
166
+ pandas_mediumint_mult = udf.pandas(
167
+ _int_mult,
168
+ name='pandas_mediumint_mult',
169
+ args=[MEDIUMINT(nullable=False), MEDIUMINT(nullable=False)],
170
+ returns=MEDIUMINT(nullable=False),
171
+ )
172
+
173
+ polars_mediumint_mult = udf.polars(
174
+ _int_mult,
175
+ name='polars_mediumint_mult',
176
+ args=[MEDIUMINT(nullable=False), MEDIUMINT(nullable=False)],
177
+ returns=MEDIUMINT(nullable=False),
178
+ )
179
+
180
+ numpy_mediumint_mult = udf.numpy(
181
+ _int_mult,
182
+ name='numpy_mediumint_mult',
183
+ args=[MEDIUMINT(nullable=False), MEDIUMINT(nullable=False)],
184
+ returns=MEDIUMINT(nullable=False),
185
+ )
186
+
187
+ arrow_mediumint_mult = udf.arrow(
188
+ _arrow_int_mult,
189
+ name='arrow_mediumint_mult',
190
+ args=[MEDIUMINT(nullable=False), MEDIUMINT(nullable=False)],
191
+ returns=MEDIUMINT(nullable=False),
192
+ )
193
+
194
+ bigint_mult = udf(
195
+ _int_mult,
196
+ name='bigint_mult',
197
+ args=[BIGINT(nullable=False), BIGINT(nullable=False)],
198
+ returns=BIGINT(nullable=False),
199
+ )
200
+
201
+ pandas_bigint_mult = udf.pandas(
202
+ _int_mult,
203
+ name='pandas_bigint_mult',
204
+ args=[BIGINT(nullable=False), BIGINT(nullable=False)],
205
+ returns=BIGINT(nullable=False),
206
+ )
207
+
208
+ polars_bigint_mult = udf.polars(
209
+ _int_mult,
210
+ name='polars_bigint_mult',
211
+ args=[BIGINT(nullable=False), BIGINT(nullable=False)],
212
+ returns=BIGINT(nullable=False),
213
+ )
214
+
215
+ numpy_bigint_mult = udf.numpy(
216
+ _int_mult,
217
+ name='numpy_bigint_mult',
218
+ args=[BIGINT(nullable=False), BIGINT(nullable=False)],
219
+ returns=BIGINT(nullable=False),
220
+ )
221
+
222
+ arrow_bigint_mult = udf.arrow(
223
+ _arrow_int_mult,
224
+ name='arrow_bigint_mult',
225
+ args=[BIGINT(nullable=False), BIGINT(nullable=False)],
226
+ returns=BIGINT(nullable=False),
227
+ )
228
+
229
+ nullable_tinyint_mult = udf(
230
+ _int_mult,
231
+ name='nullable_tinyint_mult',
232
+ args=[TINYINT, TINYINT],
233
+ returns=TINYINT,
234
+ )
235
+
236
+ pandas_nullable_tinyint_mult = udf.pandas(
237
+ _int_mult,
238
+ name='pandas_nullable_tinyint_mult',
239
+ args=[TINYINT, TINYINT],
240
+ returns=TINYINT,
241
+ )
242
+
243
+ pandas_nullable_tinyint_mult_with_masks = udf.pandas(
244
+ _int_mult_with_masks,
245
+ name='pandas_nullable_tinyint_mult_with_masks',
246
+ args=[TINYINT, TINYINT],
247
+ returns=TINYINT,
248
+ include_masks=True,
249
+ )
250
+
251
+ polars_nullable_tinyint_mult = udf.polars(
252
+ _int_mult,
253
+ name='polars_nullable_tinyint_mult',
254
+ args=[TINYINT, TINYINT],
255
+ returns=TINYINT,
256
+ )
257
+
258
+ polars_nullable_tinyint_mult_with_masks = udf.polars(
259
+ _int_mult_with_masks,
260
+ name='polars_nullable_tinyint_mult_with_masks',
261
+ args=[TINYINT, TINYINT],
262
+ returns=TINYINT,
263
+ include_masks=True,
264
+ )
265
+
266
+ numpy_nullable_tinyint_mult = udf.numpy(
267
+ _int_mult,
268
+ name='numpy_nullable_tinyint_mult',
269
+ args=[TINYINT, TINYINT],
270
+ returns=TINYINT,
271
+ )
272
+
273
+ numpy_nullable_tinyint_mult_with_masks = udf.numpy(
274
+ _int_mult_with_masks,
275
+ name='numpy_nullable_tinyint_mult_with_masks',
276
+ args=[TINYINT, TINYINT],
277
+ returns=TINYINT,
278
+ include_masks=True,
279
+ )
280
+
281
+ arrow_nullable_tinyint_mult = udf.arrow(
282
+ _arrow_int_mult,
283
+ name='arrow_nullable_tinyint_mult',
284
+ args=[TINYINT, TINYINT],
285
+ returns=TINYINT,
286
+ )
287
+
288
+ arrow_nullable_tinyint_mult_with_masks = udf.arrow(
289
+ _arrow_int_mult_with_masks,
290
+ name='arrow_nullable_tinyint_mult_with_masks',
291
+ args=[TINYINT, TINYINT],
292
+ returns=TINYINT,
293
+ include_masks=True,
294
+ )
295
+
296
+ nullable_smallint_mult = udf(
297
+ _int_mult,
298
+ name='nullable_smallint_mult',
299
+ args=[SMALLINT, SMALLINT],
300
+ returns=SMALLINT,
301
+ )
302
+
303
+ nullable_mediumint_mult = udf(
304
+ _int_mult,
305
+ name='nullable_mediumint_mult',
306
+ args=[MEDIUMINT, MEDIUMINT],
307
+ returns=MEDIUMINT,
308
+ )
309
+
310
+ nullable_bigint_mult = udf(
311
+ _int_mult,
312
+ name='nullable_bigint_mult',
313
+ args=[BIGINT, BIGINT],
314
+ returns=BIGINT,
315
+ )
316
+
317
+ numpy_nullable_bigint_mult = udf.numpy(
318
+ _int_mult,
319
+ name='numpy_nullable_bigint_mult',
320
+ args=[BIGINT, BIGINT],
321
+ returns=BIGINT,
322
+ )
323
+
324
+ numpy_nullable_bigint_mult_with_masks = udf.numpy(
325
+ _int_mult_with_masks,
326
+ name='numpy_nullable_bigint_mult',
327
+ args=[BIGINT, BIGINT],
328
+ returns=BIGINT,
329
+ include_masks=True,
330
+ )
331
+
332
+
333
+ @udf
334
+ def nullable_int_mult(x: Optional[int], y: Optional[int]) -> Optional[int]:
335
+ if x is None or y is None:
336
+ return None
337
+ return x * y
338
+
339
+
340
+ @udf
341
+ def string_mult(x: str, times: int) -> str:
342
+ return x * times
343
+
344
+
345
+ @udf.pandas
346
+ def pandas_string_mult(x: str, times: int) -> str:
347
+ return x * times
348
+
349
+
350
+ @udf.numpy
351
+ def numpy_string_mult(x: str, times: int) -> str:
352
+ return x * times
353
+
354
+
355
+ # @udf.polars
356
+ # def polars_string_mult(x: str, times: int) -> str:
357
+ # print(type(x), x, type(times), times)
358
+ # return x * times
359
+
360
+
361
+ # @udf.arrow
362
+ # def arrow_string_mult(x: str, times: int) -> str:
363
+ # print(type(x), x, type(times), times)
364
+ # import pyarrow.compute as pc
365
+ # return pc.multiply(x, times)
366
+ # return x * times
367
+
368
+
369
+ @udf
370
+ def nullable_string_mult(x: Optional[str], times: Optional[int]) -> Optional[str]:
371
+ if x is None or times is None:
372
+ return None
373
+ return x * times
374
+
375
+
376
+ @udf(args=dict(x=VARCHAR(20, nullable=False)))
377
+ def varchar_mult(x: str, times: int) -> str:
378
+ return x * times
379
+
380
+
381
+ @udf(args=dict(x=VARCHAR(20, nullable=True)))
382
+ def nullable_varchar_mult(x: Optional[str], times: Optional[int]) -> Optional[str]:
383
+ if x is None or times is None:
384
+ return None
385
+ return x * times
@@ -1,3 +1,4 @@
1
+
1
2
  CREATE ROWSTORE TABLE IF NOT EXISTS data (
2
3
  id VARCHAR(255) NOT NULL,
3
4
  name VARCHAR(255) NOT NULL,
@@ -13,6 +14,21 @@ INSERT INTO data SET id='e', name='elephants', value=0;
13
14
 
14
15
  COMMIT;
15
16
 
17
+ CREATE ROWSTORE TABLE IF NOT EXISTS data_with_nulls (
18
+ id VARCHAR(255) NOT NULL,
19
+ name VARCHAR(255),
20
+ value BIGINT,
21
+ PRIMARY KEY (id) USING HASH
22
+ ) DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
23
+
24
+ INSERT INTO data_with_nulls SET id='a', name='antelopes', value=2;
25
+ INSERT INTO data_with_nulls SET id='b', name=NULL, value=2;
26
+ INSERT INTO data_with_nulls SET id='c', name=NULL, value=5;
27
+ INSERT INTO data_with_nulls SET id='d', name='dogs', value=NULL;
28
+ INSERT INTO data_with_nulls SET id='e', name='elephants', value=0;
29
+
30
+ COMMIT;
31
+
16
32
  CREATE OR REPLACE PROCEDURE get_animal(nm VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci) AS
17
33
  BEGIN
18
34
  ECHO SELECT value FROM data WHERE name = nm; --
@@ -186,4 +202,198 @@ INSERT INTO alltypes SET
186
202
  `bit`=NULL
187
203
  ;
188
204
 
205
+ -- Minimum values
206
+ INSERT INTO alltypes SET
207
+ `id`=2,
208
+ `tinyint`=-128,
209
+ `unsigned_tinyint`=0,
210
+ `bool`=-128,
211
+ `boolean`=-128,
212
+ `smallint`=-32768,
213
+ `unsigned_smallint`=0,
214
+ `mediumint`=-8388608,
215
+ `unsigned_mediumint`=0,
216
+ `int24`=-8388608,
217
+ `unsigned_int24`=0,
218
+ `int`=-2147483648,
219
+ `unsigned_int`=0,
220
+ `integer`=-2147483648,
221
+ `unsigned_integer`=0,
222
+ `bigint`=-9223372036854775808,
223
+ `unsigned_bigint`=0,
224
+ `float`=0,
225
+ `double`=-1.7976931348623158e308,
226
+ `real`=-1.7976931348623158e308,
227
+ `decimal`=-99999999999999.999999,
228
+ `dec`=-99999999999999.999999,
229
+ `fixed`=-99999999999999.999999,
230
+ `numeric`=-99999999999999.999999,
231
+ `date`='1000-01-01',
232
+ `time`='-838:59:59',
233
+ `time_6`='-838:59:59.000000',
234
+ `datetime`='1000-01-01 00:00:00',
235
+ `datetime_6`='1000-01-01 00:00:00.000000',
236
+ `timestamp`='1970-01-01 00:00:01',
237
+ `timestamp_6`='1970-01-01 00:00:01.000000',
238
+ `year`=1901,
239
+ `char_100`='',
240
+ `binary_100`=x'',
241
+ `varchar_200`='',
242
+ `varbinary_200`=x'',
243
+ `longtext`='',
244
+ `mediumtext`='',
245
+ `text`='',
246
+ `tinytext`='',
247
+ `longblob`=x'',
248
+ `mediumblob`=x'',
249
+ `blob`=x'',
250
+ `tinyblob`=x'',
251
+ `json`='{}',
252
+ `enum`='one',
253
+ `set`='two',
254
+ `bit`=0
255
+ ;
256
+
257
+ -- Maximum values
258
+ INSERT INTO alltypes SET
259
+ `id`=3,
260
+ `tinyint`=127,
261
+ `unsigned_tinyint`=255,
262
+ `bool`=127,
263
+ `boolean`=127,
264
+ `smallint`=32767,
265
+ `unsigned_smallint`=65535,
266
+ `mediumint`=8388607,
267
+ `unsigned_mediumint`=16777215,
268
+ `int24`=8388607,
269
+ `unsigned_int24`=16777215,
270
+ `int`=2147483647,
271
+ `unsigned_int`=4294967295,
272
+ `integer`=2147483647,
273
+ `unsigned_integer`=4294967295,
274
+ `bigint`=9223372036854775807,
275
+ `unsigned_bigint`=18446744073709551615,
276
+ `float`=0,
277
+ `double`=1.7976931348623158e308,
278
+ `real`=1.7976931348623158e308,
279
+ `decimal`=99999999999999.999999,
280
+ `dec`=99999999999999.999999,
281
+ `fixed`=99999999999999.999999,
282
+ `numeric`=99999999999999.999999,
283
+ `date`='9999-12-31',
284
+ `time`='838:59:59',
285
+ `time_6`='838:59:59.999999',
286
+ `datetime`='9999-12-31 23:59:59',
287
+ `datetime_6`='9999-12-31 23:59:59.999999',
288
+ `timestamp`='2038-01-18 21:14:07',
289
+ `timestamp_6`='2038-01-18 21:14:07.999999',
290
+ `year`=2155,
291
+ `char_100`='',
292
+ `binary_100`=x'',
293
+ `varchar_200`='',
294
+ `varbinary_200`=x'',
295
+ `longtext`='',
296
+ `mediumtext`='',
297
+ `text`='',
298
+ `tinytext`='',
299
+ `longblob`=x'',
300
+ `mediumblob`=x'',
301
+ `blob`=x'',
302
+ `tinyblob`=x'',
303
+ `json`='{}',
304
+ `enum`='one',
305
+ `set`='two',
306
+ `bit`=18446744073709551615
307
+ ;
308
+
309
+ -- Zero values
310
+ --
311
+ -- Note that v8 of SingleStoreDB does not allow zero date/times by
312
+ -- default, so they are set to NULL here.
313
+ --
314
+ INSERT INTO alltypes SET
315
+ `id`=4,
316
+ `tinyint`=0,
317
+ `unsigned_tinyint`=0,
318
+ `bool`=0,
319
+ `boolean`=0,
320
+ `smallint`=0,
321
+ `unsigned_smallint`=0,
322
+ `mediumint`=0,
323
+ `unsigned_mediumint`=0,
324
+ `int24`=0,
325
+ `unsigned_int24`=0,
326
+ `int`=0,
327
+ `unsigned_int`=0,
328
+ `integer`=0,
329
+ `unsigned_integer`=0,
330
+ `bigint`=0,
331
+ `unsigned_bigint`=0,
332
+ `float`=0,
333
+ `double`=0.0,
334
+ `real`=0.0,
335
+ `decimal`=0.0,
336
+ `dec`=0.0,
337
+ `fixed`=0.0,
338
+ `numeric`=0.0,
339
+ `date`=NULL,
340
+ `time`='00:00:00',
341
+ `time_6`='00:00:00.000000',
342
+ `datetime`=NULL,
343
+ `datetime_6`=NULL,
344
+ `timestamp`=NULL,
345
+ `timestamp_6`=NULL,
346
+ `year`=NULL,
347
+ `char_100`='',
348
+ `binary_100`=x'',
349
+ `varchar_200`='',
350
+ `varbinary_200`=x'',
351
+ `longtext`='',
352
+ `mediumtext`='',
353
+ `text`='',
354
+ `tinytext`='',
355
+ `longblob`=x'',
356
+ `mediumblob`=x'',
357
+ `blob`=x'',
358
+ `tinyblob`=x'',
359
+ `json`='{}',
360
+ `enum`='one',
361
+ `set`='two',
362
+ `bit`=0
363
+ ;
364
+
365
+
366
+ --
367
+ -- Table of extended data types
368
+ --
369
+ CREATE ROWSTORE TABLE IF NOT EXISTS `extended_types` (
370
+ `id` INT(11),
371
+ `geography` GEOGRAPHY,
372
+ `geographypoint` GEOGRAPHYPOINT,
373
+ `vectors` BLOB,
374
+ `dt` DATETIME,
375
+ `d` DATE,
376
+ `t` TIME,
377
+ `td` TIME,
378
+ `testkey` LONGTEXT
379
+ )
380
+ COLLATE='utf8_unicode_ci';
381
+
382
+
383
+ --
384
+ -- Invalid utf8 table
385
+ --
386
+ -- These sequences were breaking during fetch on a customer's machine
387
+ -- however, they seem to work fine in our tests.
388
+ --
389
+ CREATE TABLE IF NOT EXISTS `badutf8` (
390
+ `text` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
391
+ )
392
+ COLLATE='utf8_unicode_ci';
393
+
394
+
395
+ INSERT INTO `badutf8` VALUES ('🥷🧙👻.eth');
396
+ INSERT INTO `badutf8` VALUES ('🥒rick.eth');
397
+
398
+
189
399
  COMMIT;
@@ -0,0 +1 @@
1
+ -- Nearly empty file for Stages test