singlestoredb 1.16.1__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.
- singlestoredb/__init__.py +75 -0
- singlestoredb/ai/__init__.py +2 -0
- singlestoredb/ai/chat.py +139 -0
- singlestoredb/ai/embeddings.py +128 -0
- singlestoredb/alchemy/__init__.py +90 -0
- singlestoredb/apps/__init__.py +3 -0
- singlestoredb/apps/_cloud_functions.py +90 -0
- singlestoredb/apps/_config.py +72 -0
- singlestoredb/apps/_connection_info.py +18 -0
- singlestoredb/apps/_dashboards.py +47 -0
- singlestoredb/apps/_process.py +32 -0
- singlestoredb/apps/_python_udfs.py +100 -0
- singlestoredb/apps/_stdout_supress.py +30 -0
- singlestoredb/apps/_uvicorn_util.py +36 -0
- singlestoredb/auth.py +245 -0
- singlestoredb/config.py +484 -0
- singlestoredb/connection.py +1487 -0
- singlestoredb/converters.py +950 -0
- singlestoredb/docstring/__init__.py +33 -0
- singlestoredb/docstring/attrdoc.py +126 -0
- singlestoredb/docstring/common.py +230 -0
- singlestoredb/docstring/epydoc.py +267 -0
- singlestoredb/docstring/google.py +412 -0
- singlestoredb/docstring/numpydoc.py +562 -0
- singlestoredb/docstring/parser.py +100 -0
- singlestoredb/docstring/py.typed +1 -0
- singlestoredb/docstring/rest.py +256 -0
- singlestoredb/docstring/tests/__init__.py +1 -0
- singlestoredb/docstring/tests/_pydoctor.py +21 -0
- singlestoredb/docstring/tests/test_epydoc.py +729 -0
- singlestoredb/docstring/tests/test_google.py +1007 -0
- singlestoredb/docstring/tests/test_numpydoc.py +1100 -0
- singlestoredb/docstring/tests/test_parse_from_object.py +109 -0
- singlestoredb/docstring/tests/test_parser.py +248 -0
- singlestoredb/docstring/tests/test_rest.py +547 -0
- singlestoredb/docstring/tests/test_util.py +70 -0
- singlestoredb/docstring/util.py +141 -0
- singlestoredb/exceptions.py +120 -0
- singlestoredb/functions/__init__.py +16 -0
- singlestoredb/functions/decorator.py +201 -0
- singlestoredb/functions/dtypes.py +1793 -0
- singlestoredb/functions/ext/__init__.py +1 -0
- singlestoredb/functions/ext/arrow.py +375 -0
- singlestoredb/functions/ext/asgi.py +2133 -0
- singlestoredb/functions/ext/json.py +420 -0
- singlestoredb/functions/ext/mmap.py +413 -0
- singlestoredb/functions/ext/rowdat_1.py +724 -0
- singlestoredb/functions/ext/timer.py +89 -0
- singlestoredb/functions/ext/utils.py +218 -0
- singlestoredb/functions/signature.py +1578 -0
- singlestoredb/functions/typing/__init__.py +41 -0
- singlestoredb/functions/typing/numpy.py +20 -0
- singlestoredb/functions/typing/pandas.py +2 -0
- singlestoredb/functions/typing/polars.py +2 -0
- singlestoredb/functions/typing/pyarrow.py +2 -0
- singlestoredb/functions/utils.py +421 -0
- singlestoredb/fusion/__init__.py +11 -0
- singlestoredb/fusion/graphql.py +213 -0
- singlestoredb/fusion/handler.py +916 -0
- singlestoredb/fusion/handlers/__init__.py +0 -0
- singlestoredb/fusion/handlers/export.py +525 -0
- singlestoredb/fusion/handlers/files.py +690 -0
- singlestoredb/fusion/handlers/job.py +660 -0
- singlestoredb/fusion/handlers/models.py +250 -0
- singlestoredb/fusion/handlers/stage.py +502 -0
- singlestoredb/fusion/handlers/utils.py +324 -0
- singlestoredb/fusion/handlers/workspace.py +956 -0
- singlestoredb/fusion/registry.py +249 -0
- singlestoredb/fusion/result.py +399 -0
- singlestoredb/http/__init__.py +27 -0
- singlestoredb/http/connection.py +1267 -0
- singlestoredb/magics/__init__.py +34 -0
- singlestoredb/magics/run_personal.py +137 -0
- singlestoredb/magics/run_shared.py +134 -0
- singlestoredb/management/__init__.py +9 -0
- singlestoredb/management/billing_usage.py +148 -0
- singlestoredb/management/cluster.py +462 -0
- singlestoredb/management/export.py +295 -0
- singlestoredb/management/files.py +1102 -0
- singlestoredb/management/inference_api.py +105 -0
- singlestoredb/management/job.py +887 -0
- singlestoredb/management/manager.py +373 -0
- singlestoredb/management/organization.py +226 -0
- singlestoredb/management/region.py +169 -0
- singlestoredb/management/utils.py +423 -0
- singlestoredb/management/workspace.py +1927 -0
- singlestoredb/mysql/__init__.py +177 -0
- singlestoredb/mysql/_auth.py +298 -0
- singlestoredb/mysql/charset.py +214 -0
- singlestoredb/mysql/connection.py +2032 -0
- singlestoredb/mysql/constants/CLIENT.py +38 -0
- singlestoredb/mysql/constants/COMMAND.py +32 -0
- singlestoredb/mysql/constants/CR.py +78 -0
- singlestoredb/mysql/constants/ER.py +474 -0
- singlestoredb/mysql/constants/EXTENDED_TYPE.py +3 -0
- singlestoredb/mysql/constants/FIELD_TYPE.py +48 -0
- singlestoredb/mysql/constants/FLAG.py +15 -0
- singlestoredb/mysql/constants/SERVER_STATUS.py +10 -0
- singlestoredb/mysql/constants/VECTOR_TYPE.py +6 -0
- singlestoredb/mysql/constants/__init__.py +0 -0
- singlestoredb/mysql/converters.py +271 -0
- singlestoredb/mysql/cursors.py +896 -0
- singlestoredb/mysql/err.py +92 -0
- singlestoredb/mysql/optionfile.py +20 -0
- singlestoredb/mysql/protocol.py +450 -0
- singlestoredb/mysql/tests/__init__.py +19 -0
- singlestoredb/mysql/tests/base.py +126 -0
- singlestoredb/mysql/tests/conftest.py +37 -0
- singlestoredb/mysql/tests/test_DictCursor.py +132 -0
- singlestoredb/mysql/tests/test_SSCursor.py +141 -0
- singlestoredb/mysql/tests/test_basic.py +452 -0
- singlestoredb/mysql/tests/test_connection.py +851 -0
- singlestoredb/mysql/tests/test_converters.py +58 -0
- singlestoredb/mysql/tests/test_cursor.py +141 -0
- singlestoredb/mysql/tests/test_err.py +16 -0
- singlestoredb/mysql/tests/test_issues.py +514 -0
- singlestoredb/mysql/tests/test_load_local.py +75 -0
- singlestoredb/mysql/tests/test_nextset.py +88 -0
- singlestoredb/mysql/tests/test_optionfile.py +27 -0
- singlestoredb/mysql/tests/thirdparty/__init__.py +6 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +9 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/capabilities.py +323 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/dbapi20.py +865 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +110 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +224 -0
- singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +101 -0
- singlestoredb/mysql/times.py +23 -0
- singlestoredb/notebook/__init__.py +16 -0
- singlestoredb/notebook/_objects.py +213 -0
- singlestoredb/notebook/_portal.py +352 -0
- singlestoredb/py.typed +0 -0
- singlestoredb/pytest.py +352 -0
- singlestoredb/server/__init__.py +0 -0
- singlestoredb/server/docker.py +452 -0
- singlestoredb/server/free_tier.py +267 -0
- singlestoredb/tests/__init__.py +0 -0
- singlestoredb/tests/alltypes.sql +307 -0
- singlestoredb/tests/alltypes_no_nulls.sql +208 -0
- singlestoredb/tests/empty.sql +0 -0
- singlestoredb/tests/ext_funcs/__init__.py +702 -0
- singlestoredb/tests/local_infile.csv +3 -0
- singlestoredb/tests/test.ipynb +18 -0
- singlestoredb/tests/test.sql +680 -0
- singlestoredb/tests/test2.ipynb +18 -0
- singlestoredb/tests/test2.sql +1 -0
- singlestoredb/tests/test_basics.py +1332 -0
- singlestoredb/tests/test_config.py +318 -0
- singlestoredb/tests/test_connection.py +3103 -0
- singlestoredb/tests/test_dbapi.py +27 -0
- singlestoredb/tests/test_exceptions.py +45 -0
- singlestoredb/tests/test_ext_func.py +1472 -0
- singlestoredb/tests/test_ext_func_data.py +1101 -0
- singlestoredb/tests/test_fusion.py +1527 -0
- singlestoredb/tests/test_http.py +288 -0
- singlestoredb/tests/test_management.py +1599 -0
- singlestoredb/tests/test_plugin.py +33 -0
- singlestoredb/tests/test_results.py +171 -0
- singlestoredb/tests/test_types.py +132 -0
- singlestoredb/tests/test_udf.py +737 -0
- singlestoredb/tests/test_udf_returns.py +459 -0
- singlestoredb/tests/test_vectorstore.py +51 -0
- singlestoredb/tests/test_xdict.py +333 -0
- singlestoredb/tests/utils.py +141 -0
- singlestoredb/types.py +373 -0
- singlestoredb/utils/__init__.py +0 -0
- singlestoredb/utils/config.py +950 -0
- singlestoredb/utils/convert_rows.py +69 -0
- singlestoredb/utils/debug.py +13 -0
- singlestoredb/utils/dtypes.py +205 -0
- singlestoredb/utils/events.py +65 -0
- singlestoredb/utils/mogrify.py +151 -0
- singlestoredb/utils/results.py +585 -0
- singlestoredb/utils/xdict.py +425 -0
- singlestoredb/vectorstore.py +192 -0
- singlestoredb/warnings.py +5 -0
- singlestoredb-1.16.1.dist-info/METADATA +165 -0
- singlestoredb-1.16.1.dist-info/RECORD +183 -0
- singlestoredb-1.16.1.dist-info/WHEEL +5 -0
- singlestoredb-1.16.1.dist-info/entry_points.txt +2 -0
- singlestoredb-1.16.1.dist-info/licenses/LICENSE +201 -0
- singlestoredb-1.16.1.dist-info/top_level.txt +3 -0
- sqlx/__init__.py +4 -0
- sqlx/magic.py +113 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""Utilities for running SingleStoreDB in the free tier."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import atexit
|
|
6
|
+
import os
|
|
7
|
+
import platform
|
|
8
|
+
import signal
|
|
9
|
+
import subprocess
|
|
10
|
+
import urllib.parse
|
|
11
|
+
from types import TracebackType
|
|
12
|
+
from typing import Any
|
|
13
|
+
from typing import Dict
|
|
14
|
+
from typing import List
|
|
15
|
+
from typing import Optional
|
|
16
|
+
from typing import Type
|
|
17
|
+
|
|
18
|
+
import requests
|
|
19
|
+
|
|
20
|
+
from .. import connect
|
|
21
|
+
from ..connection import Connection
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
import pymongo
|
|
25
|
+
has_pymongo = True
|
|
26
|
+
except ImportError:
|
|
27
|
+
has_pymongo = False
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SingleStoreDB:
|
|
31
|
+
"""
|
|
32
|
+
Manager for SingleStoreDB server running in Docker.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
-----------
|
|
36
|
+
global_vars : dict, optional
|
|
37
|
+
Global variables to set in the SingleStoreDB server.
|
|
38
|
+
init_sql : str, optional
|
|
39
|
+
Path to an SQL file to run on startup.
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
user: str
|
|
44
|
+
password: str
|
|
45
|
+
kai_enabled: bool
|
|
46
|
+
server_port: int
|
|
47
|
+
data_api_port: int
|
|
48
|
+
kai_port: Optional[int]
|
|
49
|
+
|
|
50
|
+
def __init__(self) -> None:
|
|
51
|
+
r = requests.get('https://shell.singlestore.com/api/session')
|
|
52
|
+
|
|
53
|
+
self._cookies = r.cookies.get_dict()
|
|
54
|
+
|
|
55
|
+
if 'userSessionID' in self._cookies:
|
|
56
|
+
self._session_id = self._cookies['userSessionID']
|
|
57
|
+
else:
|
|
58
|
+
self._session_id = ''
|
|
59
|
+
|
|
60
|
+
d = r.json()
|
|
61
|
+
|
|
62
|
+
self._connected = True
|
|
63
|
+
self.kai_enabled = True
|
|
64
|
+
self.kai_port = 27017
|
|
65
|
+
self.server_port = 3333
|
|
66
|
+
self.data_api_port = 443
|
|
67
|
+
self.user = d['user']
|
|
68
|
+
self.password = d['password']
|
|
69
|
+
self._database = d['databaseName']
|
|
70
|
+
self._endpoint = d['endpoint']
|
|
71
|
+
self._workspace_id = d['workspaceID']
|
|
72
|
+
|
|
73
|
+
self._saved_server_urls: Dict[str, Optional[str]] = {}
|
|
74
|
+
|
|
75
|
+
# Make sure container gets cleaned up at exit
|
|
76
|
+
atexit.register(self.stop)
|
|
77
|
+
signal.signal(signal.SIGINT, self.stop)
|
|
78
|
+
signal.signal(signal.SIGTERM, self.stop)
|
|
79
|
+
|
|
80
|
+
self._set_server_urls()
|
|
81
|
+
|
|
82
|
+
def __str__(self) -> str:
|
|
83
|
+
return f"SingleStoreDB('{self.connection_url}')"
|
|
84
|
+
|
|
85
|
+
def __repr__(self) -> str:
|
|
86
|
+
return str(self)
|
|
87
|
+
|
|
88
|
+
def _set_server_urls(self) -> None:
|
|
89
|
+
self._saved_server_urls['DATABASE_URL'] = os.environ.get('DATABASE_URL')
|
|
90
|
+
os.environ['DATABASE_URL'] = self.connection_url
|
|
91
|
+
self._saved_server_urls['SINGLESTOREDB_URL'] = os.environ.get('SINGLESTOREDB_URL')
|
|
92
|
+
os.environ['SINGLESTOREDB_URL'] = self.connection_url
|
|
93
|
+
|
|
94
|
+
def _restore_server_urls(self) -> None:
|
|
95
|
+
try:
|
|
96
|
+
for k, v in self._saved_server_urls.items():
|
|
97
|
+
if v is None:
|
|
98
|
+
del os.environ[k]
|
|
99
|
+
else:
|
|
100
|
+
os.environ[k] = v
|
|
101
|
+
except KeyError:
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
def logs(self) -> List[str]:
|
|
105
|
+
return []
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def connection_url(self) -> str:
|
|
109
|
+
"""Connection URL for the SingleStoreDB server."""
|
|
110
|
+
dbname = f'/{self._database}' if self._database else ''
|
|
111
|
+
password = urllib.parse.quote_plus(self.password)
|
|
112
|
+
return f'singlestoredb://{self.user}:{password}@' + \
|
|
113
|
+
f'{self._endpoint}:{self.server_port}{dbname}'
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def http_connection_url(self) -> str:
|
|
117
|
+
"""HTTP Connection URL for the SingleStoreDB server."""
|
|
118
|
+
dbname = f'/{self._database}' if self._database else ''
|
|
119
|
+
password = urllib.parse.quote_plus(self.password)
|
|
120
|
+
return f'singlestoredb+https://{self.user}:{password}@' + \
|
|
121
|
+
f'{self._endpoint}:{self.data_api_port}{dbname}'
|
|
122
|
+
|
|
123
|
+
def connect(
|
|
124
|
+
self,
|
|
125
|
+
use_data_api: bool = False,
|
|
126
|
+
**kwargs: Any,
|
|
127
|
+
) -> Connection:
|
|
128
|
+
"""
|
|
129
|
+
Connect to the SingleStoreDB server.
|
|
130
|
+
|
|
131
|
+
Parameters
|
|
132
|
+
-----------
|
|
133
|
+
use_data_api : bool, optional
|
|
134
|
+
Use the Data API for the connection.
|
|
135
|
+
**kwargs : Any, optional
|
|
136
|
+
Additional keyword arguments to pass to the connection.
|
|
137
|
+
|
|
138
|
+
Returns
|
|
139
|
+
--------
|
|
140
|
+
Connection : Connection to the SingleStoreDB server.
|
|
141
|
+
|
|
142
|
+
"""
|
|
143
|
+
if use_data_api:
|
|
144
|
+
return connect(self.http_connection_url, **kwargs)
|
|
145
|
+
return connect(self.connection_url, **kwargs)
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def kai_url(self) -> Optional[str]:
|
|
149
|
+
"""Connection URL for the Kai (MongoDB) server."""
|
|
150
|
+
if not self.kai_enabled:
|
|
151
|
+
return None
|
|
152
|
+
password = urllib.parse.quote_plus(self.password)
|
|
153
|
+
endpoint = self._endpoint.replace('shared-dml', 'shared-mongo')
|
|
154
|
+
return f'mongodb://{self.user}^{self._database}:{password}@' + \
|
|
155
|
+
f'{endpoint}:{self.kai_port}/' + \
|
|
156
|
+
'?authMechanism=PLAIN&tls=true&loadBalanced=true' + \
|
|
157
|
+
f'&dbName={self._database}'
|
|
158
|
+
|
|
159
|
+
def connect_kai(self) -> 'pymongo.MongoClient':
|
|
160
|
+
"""Connect to the Kai (MongoDB) server."""
|
|
161
|
+
if not self.kai_enabled:
|
|
162
|
+
raise RuntimeError('kai is not enabled')
|
|
163
|
+
if not has_pymongo:
|
|
164
|
+
raise RuntimeError('pymongo is not installed')
|
|
165
|
+
return pymongo.MongoClient(self.kai_url)
|
|
166
|
+
|
|
167
|
+
def open_shell(self) -> None:
|
|
168
|
+
"""Open a shell in the SingleStoreDB server."""
|
|
169
|
+
if platform.platform().lower().startswith('macos'):
|
|
170
|
+
subprocess.call(
|
|
171
|
+
' '.join([
|
|
172
|
+
'osascript', '-e',
|
|
173
|
+
'tell app "Terminal" to do script "' +
|
|
174
|
+
' '.join([
|
|
175
|
+
'mysql', '-h', self._endpoint,
|
|
176
|
+
'-P', str(self.server_port),
|
|
177
|
+
'-u', self.user,
|
|
178
|
+
f'--password=\'{self.password}\'',
|
|
179
|
+
self._database,
|
|
180
|
+
]) +
|
|
181
|
+
'"',
|
|
182
|
+
]), shell=True,
|
|
183
|
+
)
|
|
184
|
+
elif platform.platform().lower().startswith('linux'):
|
|
185
|
+
subprocess.call(
|
|
186
|
+
' '.join([
|
|
187
|
+
'gnome-terminal', '--',
|
|
188
|
+
'mysql', '-h', self._endpoint,
|
|
189
|
+
'-P', str(self.server_port),
|
|
190
|
+
'-u', self.user,
|
|
191
|
+
f'--password="{self.password}"',
|
|
192
|
+
self._database,
|
|
193
|
+
]), shell=True,
|
|
194
|
+
)
|
|
195
|
+
elif platform.platform().lower().startswith('windows'):
|
|
196
|
+
subprocess.call(
|
|
197
|
+
' '.join([
|
|
198
|
+
'start', 'cmd', '/k'
|
|
199
|
+
'mysql', '-h', self._endpoint,
|
|
200
|
+
'-P', str(self.server_port),
|
|
201
|
+
'-u', self.user,
|
|
202
|
+
f'--password="{self.password}"',
|
|
203
|
+
self._database,
|
|
204
|
+
]), shell=True,
|
|
205
|
+
)
|
|
206
|
+
else:
|
|
207
|
+
raise RuntimeError('unsupported platform')
|
|
208
|
+
|
|
209
|
+
def open_mongosh(self) -> None:
|
|
210
|
+
"""Open a mongosh in the SingleStoreDB server."""
|
|
211
|
+
if not self.kai_enabled:
|
|
212
|
+
raise RuntimeError('kai interface is not enabled')
|
|
213
|
+
if platform.platform().lower().startswith('macos'):
|
|
214
|
+
subprocess.call([
|
|
215
|
+
'osascript', '-e',
|
|
216
|
+
'tell app "Terminal" to do script "' +
|
|
217
|
+
' '.join(['mongosh', str(self.kai_url)]) +
|
|
218
|
+
'"',
|
|
219
|
+
])
|
|
220
|
+
elif platform.platform().lower().startswith('linux'):
|
|
221
|
+
subprocess.call([
|
|
222
|
+
'gnome-terminal', '--',
|
|
223
|
+
'mongosh', str(self.kai_url),
|
|
224
|
+
])
|
|
225
|
+
elif platform.platform().lower().startswith('windows'):
|
|
226
|
+
subprocess.call([
|
|
227
|
+
'start', 'cmd', '/k'
|
|
228
|
+
'mongosh', str(self.kai_url),
|
|
229
|
+
])
|
|
230
|
+
else:
|
|
231
|
+
raise RuntimeError('unsupported platform')
|
|
232
|
+
|
|
233
|
+
def __enter__(self) -> SingleStoreDB:
|
|
234
|
+
return self
|
|
235
|
+
|
|
236
|
+
def __exit__(
|
|
237
|
+
self,
|
|
238
|
+
exc_type: Optional[Type[BaseException]],
|
|
239
|
+
exc_val: Optional[BaseException],
|
|
240
|
+
exc_tb: Optional[TracebackType],
|
|
241
|
+
) -> Optional[bool]:
|
|
242
|
+
self.stop()
|
|
243
|
+
return None
|
|
244
|
+
|
|
245
|
+
def stop(self, *args: Any) -> None:
|
|
246
|
+
"""Stop the SingleStoreDB server."""
|
|
247
|
+
if self._connected is not None:
|
|
248
|
+
self._restore_server_urls()
|
|
249
|
+
try:
|
|
250
|
+
requests.get(
|
|
251
|
+
'https://shell.singlestore.com/api/terminate',
|
|
252
|
+
cookies=self._cookies,
|
|
253
|
+
)
|
|
254
|
+
finally:
|
|
255
|
+
self._connected = False
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def start() -> SingleStoreDB:
|
|
259
|
+
"""
|
|
260
|
+
Manager for SingleStoreDB server running in Docker.
|
|
261
|
+
|
|
262
|
+
Returns
|
|
263
|
+
-------
|
|
264
|
+
SingleStoreDB
|
|
265
|
+
|
|
266
|
+
"""
|
|
267
|
+
return SingleStoreDB()
|
|
File without changes
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS alltypes (
|
|
2
|
+
`id` INT(11),
|
|
3
|
+
`tinyint` TINYINT,
|
|
4
|
+
`unsigned_tinyint` TINYINT UNSIGNED,
|
|
5
|
+
`bool` BOOL,
|
|
6
|
+
`boolean` BOOLEAN,
|
|
7
|
+
`smallint` SMALLINT,
|
|
8
|
+
`unsigned_smallint` SMALLINT UNSIGNED,
|
|
9
|
+
`mediumint` MEDIUMINT,
|
|
10
|
+
`unsigned_mediumint` MEDIUMINT UNSIGNED,
|
|
11
|
+
`int24` MEDIUMINT,
|
|
12
|
+
`unsigned_int24` MEDIUMINT UNSIGNED,
|
|
13
|
+
`int` INT,
|
|
14
|
+
`unsigned_int` INT UNSIGNED,
|
|
15
|
+
`integer` INTEGER,
|
|
16
|
+
`unsigned_integer` INTEGER UNSIGNED,
|
|
17
|
+
`bigint` BIGINT,
|
|
18
|
+
`unsigned_bigint` BIGINT UNSIGNED,
|
|
19
|
+
`float` FLOAT,
|
|
20
|
+
`double` DOUBLE,
|
|
21
|
+
`real` REAL,
|
|
22
|
+
`decimal` DECIMAL(20,6),
|
|
23
|
+
`dec` DEC(20,6),
|
|
24
|
+
`fixed` FIXED(20,6),
|
|
25
|
+
`numeric` NUMERIC(20,6),
|
|
26
|
+
`date` DATE,
|
|
27
|
+
`time` TIME,
|
|
28
|
+
`time_6` TIME(6),
|
|
29
|
+
`datetime` DATETIME,
|
|
30
|
+
`datetime_6` DATETIME(6),
|
|
31
|
+
`timestamp` TIMESTAMP,
|
|
32
|
+
`timestamp_6` TIMESTAMP(6),
|
|
33
|
+
`year` YEAR,
|
|
34
|
+
`char_100` CHAR(100),
|
|
35
|
+
`binary_100` BINARY(100),
|
|
36
|
+
`varchar_200` VARCHAR(200),
|
|
37
|
+
`varbinary_200` VARBINARY(200),
|
|
38
|
+
`longtext` LONGTEXT,
|
|
39
|
+
`mediumtext` MEDIUMTEXT,
|
|
40
|
+
`text` TEXT,
|
|
41
|
+
`tinytext` TINYTEXT,
|
|
42
|
+
`longblob` LONGBLOB,
|
|
43
|
+
`mediumblob` MEDIUMBLOB,
|
|
44
|
+
`blob` BLOB,
|
|
45
|
+
`tinyblob` TINYBLOB,
|
|
46
|
+
`json` JSON,
|
|
47
|
+
-- `geographypoint` GEOGRAPHYPOINT,
|
|
48
|
+
-- `geography` GEOGRAPHY,
|
|
49
|
+
`enum` ENUM('one', 'two', 'three'),
|
|
50
|
+
`set` SET('one', 'two', 'three'),
|
|
51
|
+
`bit` BIT
|
|
52
|
+
)
|
|
53
|
+
COLLATE='utf8_unicode_ci';
|
|
54
|
+
|
|
55
|
+
INSERT INTO alltypes SET
|
|
56
|
+
`id`=0,
|
|
57
|
+
`tinyint`=80,
|
|
58
|
+
`unsigned_tinyint`=85,
|
|
59
|
+
`bool`=0,
|
|
60
|
+
`boolean`=1,
|
|
61
|
+
`smallint`=-27897,
|
|
62
|
+
`unsigned_smallint`=27897,
|
|
63
|
+
`mediumint`=104729,
|
|
64
|
+
`unsigned_mediumint`=120999,
|
|
65
|
+
`int24`=-200899,
|
|
66
|
+
`unsigned_int24`=407709,
|
|
67
|
+
`int`=-1295369311,
|
|
68
|
+
`unsigned_int`=3872362332,
|
|
69
|
+
`integer`=-1741727421,
|
|
70
|
+
`unsigned_integer`=3198387363,
|
|
71
|
+
`bigint`=-266883847,
|
|
72
|
+
`unsigned_bigint`=980007287362,
|
|
73
|
+
`float`=-146486683.754744,
|
|
74
|
+
`double`=-474646154.719356,
|
|
75
|
+
`real`=-901409776.279346,
|
|
76
|
+
`decimal`=28111097.610822,
|
|
77
|
+
`dec`=389451155.931428,
|
|
78
|
+
`fixed`=-143773416.044092,
|
|
79
|
+
`numeric`=866689461.300046,
|
|
80
|
+
`date`='8524-11-10',
|
|
81
|
+
`time`='00:07:00',
|
|
82
|
+
`time_6`='01:10:00.000002',
|
|
83
|
+
`datetime`='9948-03-11 15:29:22',
|
|
84
|
+
`datetime_6`='1756-10-29 02:02:42.000008',
|
|
85
|
+
`timestamp`='1980-12-31 01:10:23',
|
|
86
|
+
`timestamp_6`='1991-01-02 22:15:10.000006',
|
|
87
|
+
`year`=1923,
|
|
88
|
+
`char_100`='This is a test of a 100 character column.',
|
|
89
|
+
`binary_100`=x'000102030405060708090A0B0C0D0E0F',
|
|
90
|
+
`varchar_200`='This is a test of a variable character column.',
|
|
91
|
+
`varbinary_200`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
|
|
92
|
+
`longtext`='This is a longtext column.',
|
|
93
|
+
`mediumtext`='This is a mediumtext column.',
|
|
94
|
+
`text`='This is a text column.',
|
|
95
|
+
`tinytext`='This is a tinytext column.',
|
|
96
|
+
`longblob`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
|
|
97
|
+
`mediumblob`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
|
|
98
|
+
`blob`=x'000102030405060708090A0B0C0D0E0F',
|
|
99
|
+
`tinyblob`=x'0A0B0C0D0E0F',
|
|
100
|
+
`json`='{"a": 10, "b": 2.75, "c": "hello world"}',
|
|
101
|
+
`enum`='one',
|
|
102
|
+
`set`='two',
|
|
103
|
+
`bit`=128
|
|
104
|
+
;
|
|
105
|
+
|
|
106
|
+
INSERT INTO alltypes SET
|
|
107
|
+
`id`=1,
|
|
108
|
+
`tinyint`=NULL,
|
|
109
|
+
`bool`=NULL,
|
|
110
|
+
`boolean`=NULL,
|
|
111
|
+
`smallint`=NULL,
|
|
112
|
+
`mediumint`=NULL,
|
|
113
|
+
`int24`=NULL,
|
|
114
|
+
`int`=NULL,
|
|
115
|
+
`integer`=NULL,
|
|
116
|
+
`bigint`=NULL,
|
|
117
|
+
`float`=NULL,
|
|
118
|
+
`double`=NULL,
|
|
119
|
+
`real`=NULL,
|
|
120
|
+
`decimal`=NULL,
|
|
121
|
+
`dec`=NULL,
|
|
122
|
+
`fixed`=NULL,
|
|
123
|
+
`numeric`=NULL,
|
|
124
|
+
`date`=NULL,
|
|
125
|
+
`time`=NULL,
|
|
126
|
+
`time_6`=NULL,
|
|
127
|
+
`datetime`=NULL,
|
|
128
|
+
`datetime_6`=NULL,
|
|
129
|
+
`timestamp`=NULL,
|
|
130
|
+
`timestamp_6`=NULL,
|
|
131
|
+
`year`=NULL,
|
|
132
|
+
`char_100`=NULL,
|
|
133
|
+
`binary_100`=NULL,
|
|
134
|
+
`varchar_200`=NULL,
|
|
135
|
+
`longtext`=NULL,
|
|
136
|
+
`mediumtext`=NULL,
|
|
137
|
+
`text`=NULL,
|
|
138
|
+
`tinytext`=NULL,
|
|
139
|
+
`longblob`=NULL,
|
|
140
|
+
`mediumblob`=NULL,
|
|
141
|
+
`blob`=NULL,
|
|
142
|
+
`tinyblob`=NULL,
|
|
143
|
+
`json`=NULL,
|
|
144
|
+
`enum`=NULL,
|
|
145
|
+
`set`=NULL,
|
|
146
|
+
`bit`=NULL
|
|
147
|
+
;
|
|
148
|
+
|
|
149
|
+
-- Minimum values
|
|
150
|
+
INSERT INTO alltypes SET
|
|
151
|
+
`id`=2,
|
|
152
|
+
`tinyint`=-128,
|
|
153
|
+
`unsigned_tinyint`=0,
|
|
154
|
+
`bool`=-128,
|
|
155
|
+
`boolean`=-128,
|
|
156
|
+
`smallint`=-32768,
|
|
157
|
+
`unsigned_smallint`=0,
|
|
158
|
+
`mediumint`=-8388608,
|
|
159
|
+
`unsigned_mediumint`=0,
|
|
160
|
+
`int24`=-8388608,
|
|
161
|
+
`unsigned_int24`=0,
|
|
162
|
+
`int`=-2147483648,
|
|
163
|
+
`unsigned_int`=0,
|
|
164
|
+
`integer`=-2147483648,
|
|
165
|
+
`unsigned_integer`=0,
|
|
166
|
+
`bigint`=-9223372036854775808,
|
|
167
|
+
`unsigned_bigint`=0,
|
|
168
|
+
`float`=0,
|
|
169
|
+
`double`=-1.7976931348623158e308,
|
|
170
|
+
`real`=-1.7976931348623158e308,
|
|
171
|
+
`decimal`=-99999999999999.999999,
|
|
172
|
+
`dec`=-99999999999999.999999,
|
|
173
|
+
`fixed`=-99999999999999.999999,
|
|
174
|
+
`numeric`=-99999999999999.999999,
|
|
175
|
+
`date`='1000-01-01',
|
|
176
|
+
`time`='-838:59:59',
|
|
177
|
+
`time_6`='-838:59:59.000000',
|
|
178
|
+
`datetime`='1000-01-01 00:00:00',
|
|
179
|
+
`datetime_6`='1000-01-01 00:00:00.000000',
|
|
180
|
+
`timestamp`='1970-01-01 00:00:01',
|
|
181
|
+
`timestamp_6`='1970-01-01 00:00:01.000000',
|
|
182
|
+
`year`=1901,
|
|
183
|
+
`char_100`='',
|
|
184
|
+
`binary_100`=x'',
|
|
185
|
+
`varchar_200`='',
|
|
186
|
+
`varbinary_200`=x'',
|
|
187
|
+
`longtext`='',
|
|
188
|
+
`mediumtext`='',
|
|
189
|
+
`text`='',
|
|
190
|
+
`tinytext`='',
|
|
191
|
+
`longblob`=x'',
|
|
192
|
+
`mediumblob`=x'',
|
|
193
|
+
`blob`=x'',
|
|
194
|
+
`tinyblob`=x'',
|
|
195
|
+
`json`='{}',
|
|
196
|
+
`enum`='one',
|
|
197
|
+
`set`='two',
|
|
198
|
+
`bit`=0
|
|
199
|
+
;
|
|
200
|
+
|
|
201
|
+
-- Maximum values
|
|
202
|
+
INSERT INTO alltypes SET
|
|
203
|
+
`id`=3,
|
|
204
|
+
`tinyint`=127,
|
|
205
|
+
`unsigned_tinyint`=255,
|
|
206
|
+
`bool`=127,
|
|
207
|
+
`boolean`=127,
|
|
208
|
+
`smallint`=32767,
|
|
209
|
+
`unsigned_smallint`=65535,
|
|
210
|
+
`mediumint`=8388607,
|
|
211
|
+
`unsigned_mediumint`=16777215,
|
|
212
|
+
`int24`=8388607,
|
|
213
|
+
`unsigned_int24`=16777215,
|
|
214
|
+
`int`=2147483647,
|
|
215
|
+
`unsigned_int`=4294967295,
|
|
216
|
+
`integer`=2147483647,
|
|
217
|
+
`unsigned_integer`=4294967295,
|
|
218
|
+
`bigint`=9223372036854775807,
|
|
219
|
+
`unsigned_bigint`=18446744073709551615,
|
|
220
|
+
`float`=0,
|
|
221
|
+
`double`=1.7976931348623158e308,
|
|
222
|
+
`real`=1.7976931348623158e308,
|
|
223
|
+
`decimal`=99999999999999.999999,
|
|
224
|
+
`dec`=99999999999999.999999,
|
|
225
|
+
`fixed`=99999999999999.999999,
|
|
226
|
+
`numeric`=99999999999999.999999,
|
|
227
|
+
`date`='9999-12-31',
|
|
228
|
+
`time`='838:59:59',
|
|
229
|
+
`time_6`='838:59:59.999999',
|
|
230
|
+
`datetime`='9999-12-31 23:59:59',
|
|
231
|
+
`datetime_6`='9999-12-31 23:59:59.999999',
|
|
232
|
+
`timestamp`='2038-01-18 21:14:07',
|
|
233
|
+
`timestamp_6`='2038-01-18 21:14:07.999999',
|
|
234
|
+
`year`=2155,
|
|
235
|
+
`char_100`='',
|
|
236
|
+
`binary_100`=x'',
|
|
237
|
+
`varchar_200`='',
|
|
238
|
+
`varbinary_200`=x'',
|
|
239
|
+
`longtext`='',
|
|
240
|
+
`mediumtext`='',
|
|
241
|
+
`text`='',
|
|
242
|
+
`tinytext`='',
|
|
243
|
+
`longblob`=x'',
|
|
244
|
+
`mediumblob`=x'',
|
|
245
|
+
`blob`=x'',
|
|
246
|
+
`tinyblob`=x'',
|
|
247
|
+
`json`='{}',
|
|
248
|
+
`enum`='one',
|
|
249
|
+
`set`='two',
|
|
250
|
+
`bit`=18446744073709551615
|
|
251
|
+
;
|
|
252
|
+
|
|
253
|
+
-- Zero values
|
|
254
|
+
--
|
|
255
|
+
-- Note that v8 of SingleStoreDB does not allow zero date/times by
|
|
256
|
+
-- default, so they are set to NULL here.
|
|
257
|
+
--
|
|
258
|
+
INSERT INTO alltypes SET
|
|
259
|
+
`id`=4,
|
|
260
|
+
`tinyint`=0,
|
|
261
|
+
`unsigned_tinyint`=0,
|
|
262
|
+
`bool`=0,
|
|
263
|
+
`boolean`=0,
|
|
264
|
+
`smallint`=0,
|
|
265
|
+
`unsigned_smallint`=0,
|
|
266
|
+
`mediumint`=0,
|
|
267
|
+
`unsigned_mediumint`=0,
|
|
268
|
+
`int24`=0,
|
|
269
|
+
`unsigned_int24`=0,
|
|
270
|
+
`int`=0,
|
|
271
|
+
`unsigned_int`=0,
|
|
272
|
+
`integer`=0,
|
|
273
|
+
`unsigned_integer`=0,
|
|
274
|
+
`bigint`=0,
|
|
275
|
+
`unsigned_bigint`=0,
|
|
276
|
+
`float`=0,
|
|
277
|
+
`double`=0.0,
|
|
278
|
+
`real`=0.0,
|
|
279
|
+
`decimal`=0.0,
|
|
280
|
+
`dec`=0.0,
|
|
281
|
+
`fixed`=0.0,
|
|
282
|
+
`numeric`=0.0,
|
|
283
|
+
`date`=NULL,
|
|
284
|
+
`time`='00:00:00',
|
|
285
|
+
`time_6`='00:00:00.000000',
|
|
286
|
+
`datetime`=NULL,
|
|
287
|
+
`datetime_6`=NULL,
|
|
288
|
+
`timestamp`=NULL,
|
|
289
|
+
`timestamp_6`=NULL,
|
|
290
|
+
`year`=NULL,
|
|
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`=0
|
|
307
|
+
;
|