singlestoredb 0.8.8__tar.gz → 0.9.0__tar.gz

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 (102) hide show
  1. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/PKG-INFO +1 -1
  2. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/accel.c +107 -193
  3. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/setup.cfg +1 -1
  4. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/__init__.py +1 -1
  5. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/config.py +6 -0
  6. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/exceptions.py +24 -0
  7. singlestoredb-0.9.0/singlestoredb/functions/__init__.py +1 -0
  8. singlestoredb-0.9.0/singlestoredb/functions/decorator.py +165 -0
  9. singlestoredb-0.9.0/singlestoredb/functions/dtypes.py +1396 -0
  10. singlestoredb-0.9.0/singlestoredb/functions/ext/__init__.py +2 -0
  11. singlestoredb-0.9.0/singlestoredb/functions/ext/asgi.py +357 -0
  12. singlestoredb-0.9.0/singlestoredb/functions/ext/json.py +49 -0
  13. singlestoredb-0.9.0/singlestoredb/functions/ext/rowdat_1.py +111 -0
  14. singlestoredb-0.9.0/singlestoredb/functions/signature.py +607 -0
  15. singlestoredb-0.9.0/singlestoredb/management/billing_usage.py +148 -0
  16. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/management/manager.py +42 -1
  17. singlestoredb-0.9.0/singlestoredb/management/organization.py +85 -0
  18. singlestoredb-0.9.0/singlestoredb/management/utils.py +157 -0
  19. singlestoredb-0.9.0/singlestoredb/management/workspace.py +1457 -0
  20. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/__init__.py +12 -10
  21. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/_auth.py +3 -1
  22. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/charset.py +12 -11
  23. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/connection.py +4 -3
  24. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/CLIENT.py +0 -1
  25. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/COMMAND.py +0 -1
  26. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/CR.py +0 -2
  27. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/ER.py +0 -1
  28. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/FIELD_TYPE.py +0 -1
  29. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/FLAG.py +0 -1
  30. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/SERVER_STATUS.py +0 -1
  31. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/converters.py +49 -28
  32. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/err.py +3 -3
  33. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/optionfile.py +4 -4
  34. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/protocol.py +2 -1
  35. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/times.py +3 -4
  36. singlestoredb-0.9.0/singlestoredb/tests/test2.sql +1 -0
  37. singlestoredb-0.9.0/singlestoredb/tests/test_management.py +694 -0
  38. singlestoredb-0.9.0/singlestoredb/tests/test_udf.py +698 -0
  39. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb.egg-info/PKG-INFO +1 -1
  40. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb.egg-info/SOURCES.txt +12 -0
  41. singlestoredb-0.8.8/singlestoredb/management/utils.py +0 -40
  42. singlestoredb-0.8.8/singlestoredb/management/workspace.py +0 -581
  43. singlestoredb-0.8.8/singlestoredb/tests/test_management.py +0 -304
  44. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/LICENSE +0 -0
  45. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/README.md +0 -0
  46. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/setup.py +0 -0
  47. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/alchemy/__init__.py +0 -0
  48. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/auth.py +0 -0
  49. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/connection.py +0 -0
  50. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/converters.py +0 -0
  51. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/http/__init__.py +0 -0
  52. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/http/connection.py +0 -0
  53. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/management/__init__.py +0 -0
  54. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/management/cluster.py +0 -0
  55. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/management/region.py +0 -0
  56. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/constants/__init__.py +0 -0
  57. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/cursors.py +0 -0
  58. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/__init__.py +0 -0
  59. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/base.py +0 -0
  60. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/conftest.py +0 -0
  61. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_DictCursor.py +0 -0
  62. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_SSCursor.py +0 -0
  63. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_basic.py +0 -0
  64. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_connection.py +0 -0
  65. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_converters.py +0 -0
  66. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_cursor.py +0 -0
  67. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_err.py +0 -0
  68. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_issues.py +0 -0
  69. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_load_local.py +0 -0
  70. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_nextset.py +0 -0
  71. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/test_optionfile.py +0 -0
  72. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/__init__.py +0 -0
  73. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +0 -0
  74. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/capabilities.py +0 -0
  75. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/dbapi20.py +0 -0
  76. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +0 -0
  77. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +0 -0
  78. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +0 -0
  79. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/__init__.py +0 -0
  80. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/empty.sql +0 -0
  81. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/local_infile.csv +0 -0
  82. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test.sql +0 -0
  83. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_basics.py +0 -0
  84. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_config.py +0 -0
  85. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_connection.py +0 -0
  86. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_dbapi.py +0 -0
  87. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_exceptions.py +0 -0
  88. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_http.py +0 -0
  89. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_results.py +0 -0
  90. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_types.py +0 -0
  91. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/test_xdict.py +0 -0
  92. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/tests/utils.py +0 -0
  93. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/types.py +0 -0
  94. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/__init__.py +0 -0
  95. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/config.py +0 -0
  96. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/convert_rows.py +0 -0
  97. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/debug.py +0 -0
  98. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/results.py +0 -0
  99. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb/utils/xdict.py +0 -0
  100. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb.egg-info/dependency_links.txt +0 -0
  101. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb.egg-info/requires.txt +0 -0
  102. {singlestoredb-0.8.8 → singlestoredb-0.9.0}/singlestoredb.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 0.8.8
3
+ Version: 0.9.0
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -79,57 +79,6 @@
79
79
  #define ACCEL_OPTION_BIT_TYPE_BYTES 0
80
80
  #define ACCEL_OPTION_BIT_TYPE_INT 1
81
81
 
82
- //
83
- // !! MUST BE KEPT IN SYNC WITH singlestoredb/ext_func/dtypes.py!!!
84
- //
85
- #define DATATYPE_BOOL 0
86
- #define DATATYPE_BOOLEAN 0
87
- #define DATATYPE_BIT 1
88
- #define DATATYPE_TINYINT 2
89
- #define DATATYPE_UNSIGNED_TINYINT 3
90
- #define DATATYPE_SMALLINT 4
91
- #define DATATYPE_UNSIGNED_SMALLINT 5
92
- #define DATATYPE_MEDIUMINT 6
93
- #define DATATYPE_UNSIGNED_MEDIUMINT 7
94
- #define DATATYPE_INT 8
95
- #define DATATYPE_INTEGER 8
96
- #define DATATYPE_UNSIGNED_INT 9
97
- #define DATATYPE_UNSIGNED_INTEGER 9
98
- #define DATATYPE_BIGINT 10
99
- #define DATATYPE_UNSIGNED_BIGINT 11
100
- #define DATATYPE_FLOAT 12
101
- #define DATATYPE_DOUBLE 13
102
- #define DATATYPE_REAL 13
103
- #define DATATYPE_DECIMAL 14
104
- #define DATATYPE_DEC 14
105
- #define DATATYPE_FIXED 14
106
- #define DATATYPE_NUMERIC 14
107
- #define DATATYPE_DATE 15
108
- #define DATATYPE_TIME 16
109
- #define DATATYPE_TIME_6 17
110
- #define DATATYPE_DATETIME 18
111
- #define DATATYPE_DATETIME_6 19
112
- #define DATATYPE_TIMESTAMP 20
113
- #define DATATYPE_TIMESTAMP_6 21
114
- #define DATATYPE_YEAR 22
115
- #define DATATYPE_CHAR 23
116
- #define DATATYPE_VARCHAR 24
117
- #define DATATYPE_LONGTEXT 25
118
- #define DATATYPE_MEDIUMTEXT 26
119
- #define DATATYPE_TEXT 27
120
- #define DATATYPE_TINYTEXT 28
121
- #define DATATYPE_BINARY 29
122
- #define DATATYPE_VARBINARY 30
123
- #define DATATYPE_LONGBLOB 31
124
- #define DATATYPE_MEDIUMBLOB 32
125
- #define DATATYPE_BLOB 33
126
- #define DATATYPE_TINYBLOB 34
127
- #define DATATYPE_JSON 35
128
- #define DATATYPE_GEOGRAPHYPOINT 36
129
- #define DATATYPE_GEOGRAPHY 37
130
- #define DATATYPE_ARRAY 101
131
- #define DATATYPE_RECORD 102
132
-
133
82
  #define CHR2INT1(x) ((x)[1] - '0')
134
83
  #define CHR2INT2(x) ((((x)[0] - '0') * 10) + ((x)[1] - '0'))
135
84
  #define CHR2INT3(x) ((((x)[0] - '0') * 1e2) + (((x)[1] - '0') * 10) + ((x)[2] - '0'))
@@ -1830,7 +1779,7 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1830
1779
  uint64_t u64 = 0;
1831
1780
  float flt = 0;
1832
1781
  double dbl = 0;
1833
- uint8_t *ctypes = NULL;
1782
+ int *ctypes = NULL;
1834
1783
  char *data = NULL;
1835
1784
  char *end = NULL;
1836
1785
  unsigned long long colspec_l = 0;
@@ -1850,18 +1799,17 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1850
1799
  goto error;
1851
1800
  }
1852
1801
 
1853
- ctypes = malloc(sizeof(uint8_t) * colspec_l);
1802
+ ctypes = malloc(sizeof(int) * colspec_l);
1854
1803
 
1855
1804
  for (i = 0; i < colspec_l; i++) {
1856
1805
  PyObject *py_cspec = PySequence_GetItem(py_colspec, i);
1857
1806
  if (!py_cspec) goto error;
1858
1807
  PyObject *py_ctype = PySequence_GetItem(py_cspec, 1);
1859
1808
  if (!py_ctype) { Py_DECREF(py_cspec); goto error; }
1860
- PyObject *py_id = PyObject_GetAttrString(py_ctype, "id");
1861
- if (!py_id) { Py_DECREF(py_cspec); Py_DECREF(py_ctype); goto error; }
1862
- ctypes[i] = (uint8_t)PyLong_AsLong(py_id);
1809
+ ctypes[i] = (int)PyLong_AsLong(py_ctype);
1863
1810
  Py_DECREF(py_ctype);
1864
1811
  Py_DECREF(py_cspec);
1812
+ if (PyErr_Occurred()) { goto error; }
1865
1813
  }
1866
1814
 
1867
1815
  py_out_row_ids = PyList_New(0);
@@ -1896,23 +1844,17 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1896
1844
  if (is_null) Py_INCREF(Py_None);
1897
1845
 
1898
1846
  switch (ctypes[i]) {
1899
- case DATATYPE_BOOL:
1900
- //case DATATYPE_BOOLEAN:
1901
- i8 = *(int8_t*)data; data += 1;
1902
- if (is_null) {
1903
- CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
1904
- Py_INCREF(Py_None);
1905
- } else {
1906
- CHECKRC(PyTuple_SetItem(py_row, i, (i8) ? Py_True : Py_False));
1907
- Py_INCREF((i8) ? Py_True : Py_False);
1908
- }
1847
+ case MYSQL_TYPE_NULL:
1848
+ data += 1;
1849
+ CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
1850
+ Py_INCREF(Py_None);
1909
1851
  break;
1910
1852
 
1911
- case DATATYPE_BIT:
1853
+ case MYSQL_TYPE_BIT:
1912
1854
  // TODO
1913
1855
  break;
1914
1856
 
1915
- case DATATYPE_TINYINT:
1857
+ case MYSQL_TYPE_TINY:
1916
1858
  i8 = *(int8_t*)data; data += 1;
1917
1859
  if (is_null) {
1918
1860
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1922,7 +1864,8 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1922
1864
  }
1923
1865
  break;
1924
1866
 
1925
- case DATATYPE_UNSIGNED_TINYINT:
1867
+ // Use negative to indicate unsigned
1868
+ case -MYSQL_TYPE_TINY:
1926
1869
  u8 = *(uint8_t*)data; data += 1;
1927
1870
  if (is_null) {
1928
1871
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1932,7 +1875,7 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1932
1875
  }
1933
1876
  break;
1934
1877
 
1935
- case DATATYPE_SMALLINT:
1878
+ case MYSQL_TYPE_SHORT:
1936
1879
  i16 = *(int16_t*)data; data += 2;
1937
1880
  if (is_null) {
1938
1881
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1942,7 +1885,8 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1942
1885
  }
1943
1886
  break;
1944
1887
 
1945
- case DATATYPE_UNSIGNED_SMALLINT:
1888
+ // Use negative to indicate unsigned
1889
+ case -MYSQL_TYPE_SHORT:
1946
1890
  u16 = *(uint16_t*)data; data += 2;
1947
1891
  if (is_null) {
1948
1892
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1952,9 +1896,8 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1952
1896
  }
1953
1897
  break;
1954
1898
 
1955
- case DATATYPE_MEDIUMINT:
1956
- case DATATYPE_INT:
1957
- //case DATATYPE_INTEGER:
1899
+ case MYSQL_TYPE_LONG:
1900
+ case MYSQL_TYPE_INT24:
1958
1901
  i32 = *(int32_t*)data; data += 4;
1959
1902
  if (is_null) {
1960
1903
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1964,9 +1907,9 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1964
1907
  }
1965
1908
  break;
1966
1909
 
1967
- case DATATYPE_UNSIGNED_MEDIUMINT:
1968
- case DATATYPE_UNSIGNED_INT:
1969
- //case DATATYPE_UNSIGNED_INTEGER:
1910
+ // Use negative to indicate unsigned
1911
+ case -MYSQL_TYPE_LONG:
1912
+ case -MYSQL_TYPE_INT24:
1970
1913
  u32 = *(uint32_t*)data; data += 4;
1971
1914
  if (is_null) {
1972
1915
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1976,7 +1919,7 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1976
1919
  }
1977
1920
  break;
1978
1921
 
1979
- case DATATYPE_BIGINT:
1922
+ case MYSQL_TYPE_LONGLONG:
1980
1923
  i64 = *(int64_t*)data; data += 8;
1981
1924
  if (is_null) {
1982
1925
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1986,7 +1929,8 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1986
1929
  }
1987
1930
  break;
1988
1931
 
1989
- case DATATYPE_UNSIGNED_BIGINT:
1932
+ // Use negative to indicate unsigned
1933
+ case -MYSQL_TYPE_LONGLONG:
1990
1934
  u64 = *(uint64_t*)data; data += 8;
1991
1935
  if (is_null) {
1992
1936
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -1996,7 +1940,7 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
1996
1940
  }
1997
1941
  break;
1998
1942
 
1999
- case DATATYPE_FLOAT:
1943
+ case MYSQL_TYPE_FLOAT:
2000
1944
  flt = *(float*)data; data += 4;
2001
1945
  if (is_null) {
2002
1946
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -2006,8 +1950,7 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2006
1950
  }
2007
1951
  break;
2008
1952
 
2009
- case DATATYPE_DOUBLE:
2010
- //case DATATYPE_REAL:
1953
+ case MYSQL_TYPE_DOUBLE:
2011
1954
  dbl = *(double*)data; data += 8;
2012
1955
  if (is_null) {
2013
1956
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -2017,42 +1960,29 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2017
1960
  }
2018
1961
  break;
2019
1962
 
2020
- case DATATYPE_DECIMAL:
2021
- //case DATATYPE_DEC:
2022
- //case DATATYPE_FIXED:
2023
- //case DATATYPE_NUMERIC:
2024
- // TODO
2025
- break;
2026
-
2027
- case DATATYPE_DATE:
2028
- // TODO
2029
- break;
2030
-
2031
- case DATATYPE_TIME:
1963
+ case MYSQL_TYPE_DECIMAL:
1964
+ case MYSQL_TYPE_NEWDECIMAL:
2032
1965
  // TODO
2033
1966
  break;
2034
1967
 
2035
- case DATATYPE_TIME_6:
1968
+ case MYSQL_TYPE_DATE:
1969
+ case MYSQL_TYPE_NEWDATE:
2036
1970
  // TODO
2037
1971
  break;
2038
1972
 
2039
- case DATATYPE_DATETIME:
1973
+ case MYSQL_TYPE_TIME:
2040
1974
  // TODO
2041
1975
  break;
2042
1976
 
2043
- case DATATYPE_DATETIME_6:
1977
+ case MYSQL_TYPE_DATETIME:
2044
1978
  // TODO
2045
1979
  break;
2046
1980
 
2047
- case DATATYPE_TIMESTAMP:
1981
+ case MYSQL_TYPE_TIMESTAMP:
2048
1982
  // TODO
2049
1983
  break;
2050
1984
 
2051
- case DATATYPE_TIMESTAMP_6:
2052
- // TODO
2053
- break;
2054
-
2055
- case DATATYPE_YEAR:
1985
+ case MYSQL_TYPE_YEAR:
2056
1986
  u16 = *(uint16_t*)data; data += 2;
2057
1987
  if (is_null) {
2058
1988
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -2062,15 +1992,17 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2062
1992
  }
2063
1993
  break;
2064
1994
 
2065
- case DATATYPE_CHAR:
2066
- case DATATYPE_VARCHAR:
2067
- case DATATYPE_LONGTEXT:
2068
- case DATATYPE_MEDIUMTEXT:
2069
- case DATATYPE_TEXT:
2070
- case DATATYPE_TINYTEXT:
2071
- case DATATYPE_JSON:
2072
- case DATATYPE_GEOGRAPHYPOINT:
2073
- case DATATYPE_GEOGRAPHY:
1995
+ case MYSQL_TYPE_VARCHAR:
1996
+ case MYSQL_TYPE_JSON:
1997
+ case MYSQL_TYPE_SET:
1998
+ case MYSQL_TYPE_ENUM:
1999
+ case MYSQL_TYPE_VAR_STRING:
2000
+ case MYSQL_TYPE_STRING:
2001
+ case MYSQL_TYPE_GEOMETRY:
2002
+ case MYSQL_TYPE_TINY_BLOB:
2003
+ case MYSQL_TYPE_MEDIUM_BLOB:
2004
+ case MYSQL_TYPE_LONG_BLOB:
2005
+ case MYSQL_TYPE_BLOB:
2074
2006
  i64 = *(int64_t*)data; data += 8;
2075
2007
  if (is_null) {
2076
2008
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -2083,12 +2015,18 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2083
2015
  }
2084
2016
  break;
2085
2017
 
2086
- case DATATYPE_BINARY:
2087
- case DATATYPE_VARBINARY:
2088
- case DATATYPE_LONGBLOB:
2089
- case DATATYPE_MEDIUMBLOB:
2090
- case DATATYPE_BLOB:
2091
- case DATATYPE_TINYBLOB:
2018
+ // Use negative to indicate binary
2019
+ case -MYSQL_TYPE_VARCHAR:
2020
+ case -MYSQL_TYPE_JSON:
2021
+ case -MYSQL_TYPE_SET:
2022
+ case -MYSQL_TYPE_ENUM:
2023
+ case -MYSQL_TYPE_VAR_STRING:
2024
+ case -MYSQL_TYPE_STRING:
2025
+ case -MYSQL_TYPE_GEOMETRY:
2026
+ case -MYSQL_TYPE_TINY_BLOB:
2027
+ case -MYSQL_TYPE_MEDIUM_BLOB:
2028
+ case -MYSQL_TYPE_LONG_BLOB:
2029
+ case -MYSQL_TYPE_BLOB:
2092
2030
  i64 = *(int64_t*)data; data += 8;
2093
2031
  if (is_null) {
2094
2032
  CHECKRC(PyTuple_SetItem(py_row, i, Py_None));
@@ -2101,11 +2039,6 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2101
2039
  }
2102
2040
  break;
2103
2041
 
2104
- case DATATYPE_ARRAY:
2105
- case DATATYPE_RECORD:
2106
- // TODO
2107
- break;
2108
-
2109
2042
  default:
2110
2043
  goto error;
2111
2044
  }
@@ -2154,7 +2087,7 @@ static PyObject *dump_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2154
2087
  unsigned long long out_l = 0;
2155
2088
  unsigned long long out_idx = 0;
2156
2089
  Py_ssize_t length = 0;
2157
- uint8_t *returns = NULL;
2090
+ int *returns = NULL;
2158
2091
  unsigned long long returns_l = 0;
2159
2092
  char *keywords[] = {"returns", "data", NULL};
2160
2093
  unsigned long long i = 0;
@@ -2180,16 +2113,15 @@ static PyObject *dump_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2180
2113
  returns_l = (unsigned long long)PyObject_Length(py_returns);
2181
2114
  if (returns_l == 0) goto error;
2182
2115
 
2183
- returns = malloc(sizeof(uint8_t) * length);
2116
+ returns = malloc(sizeof(int) * length);
2184
2117
  if (!returns) goto error;
2185
2118
 
2186
2119
  for (i = 0; i < returns_l; i++) {
2187
2120
  PyObject *py_item = PySequence_GetItem(py_returns, i);
2188
2121
  if (!py_item) goto error;
2189
- PyObject *py_id = PyObject_GetAttrString(py_item, "id");
2190
- if (!py_id) { Py_DECREF(py_item); goto error; }
2191
- returns[i] = (uint8_t)PyLong_AsLong(py_id);
2122
+ returns[i] = (int)PyLong_AsLong(py_item);
2192
2123
  Py_DECREF(py_item);
2124
+ if (PyErr_Occurred()) { goto error; }
2193
2125
  }
2194
2126
 
2195
2127
  #define CHECKMEM(x) \
@@ -2226,144 +2158,125 @@ static PyObject *dump_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2226
2158
  out_idx += 1;
2227
2159
 
2228
2160
  switch (returns[i]) {
2229
- case DATATYPE_BOOL:
2230
- //case DATATYPE_BOOLEAN:
2231
- CHECKMEM(1);
2232
- i8 = (is_null) ? 0 : (int8_t)PyLong_AsLong(py_item);
2233
- memcpy(out+out_idx, &i8, 1);
2234
- out_idx += 1;
2235
- break;
2236
-
2237
- case DATATYPE_BIT:
2161
+ case MYSQL_TYPE_BIT:
2238
2162
  // TODO
2239
2163
  break;
2240
2164
 
2241
- case DATATYPE_TINYINT:
2165
+ case MYSQL_TYPE_TINY:
2242
2166
  CHECKMEM(1);
2243
2167
  i8 = (is_null) ? 0 : (int8_t)PyLong_AsLong(py_item);
2244
2168
  memcpy(out+out_idx, &i8, 1);
2245
2169
  out_idx += 1;
2246
2170
  break;
2247
2171
 
2248
- case DATATYPE_UNSIGNED_TINYINT:
2172
+ // Use negative to indicate unsigned
2173
+ case -MYSQL_TYPE_TINY:
2249
2174
  CHECKMEM(1);
2250
2175
  u8 = (is_null) ? 0 : (uint8_t)PyLong_AsUnsignedLong(py_item);
2251
2176
  memcpy(out+out_idx, &u8, 1);
2252
2177
  out_idx += 1;
2253
2178
  break;
2254
2179
 
2255
- case DATATYPE_SMALLINT:
2180
+ case MYSQL_TYPE_SHORT:
2256
2181
  CHECKMEM(2);
2257
2182
  i16 = (is_null) ? 0 : (int16_t)PyLong_AsLong(py_item);
2258
2183
  memcpy(out+out_idx, &i16, 2);
2259
2184
  out_idx += 2;
2260
2185
  break;
2261
2186
 
2262
- case DATATYPE_UNSIGNED_SMALLINT:
2187
+ // Use negative to indicate unsigned
2188
+ case -MYSQL_TYPE_SHORT:
2263
2189
  CHECKMEM(2);
2264
2190
  u16 = (is_null) ? 0 : (uint16_t)PyLong_AsUnsignedLong(py_item);
2265
2191
  memcpy(out+out_idx, &u16, 2);
2266
2192
  out_idx += 2;
2267
2193
  break;
2268
2194
 
2269
- case DATATYPE_MEDIUMINT:
2270
- case DATATYPE_INT:
2271
- //case DATATYPE_INTEGER:
2195
+ case MYSQL_TYPE_LONG:
2196
+ case MYSQL_TYPE_INT24:
2272
2197
  CHECKMEM(4);
2273
2198
  i32 = (is_null) ? 0 : (int32_t)PyLong_AsLong(py_item);
2274
2199
  memcpy(out+out_idx, &i32, 4);
2275
2200
  out_idx += 4;
2276
2201
  break;
2277
2202
 
2278
- case DATATYPE_UNSIGNED_MEDIUMINT:
2279
- case DATATYPE_UNSIGNED_INT:
2280
- //case DATATYPE_UNSIGNED_INTEGER:
2203
+ // Use negative to indicate unsigned
2204
+ case -MYSQL_TYPE_LONG:
2205
+ case -MYSQL_TYPE_INT24:
2281
2206
  CHECKMEM(4);
2282
2207
  u32 = (is_null) ? 0 : (uint32_t)PyLong_AsUnsignedLong(py_item);
2283
2208
  memcpy(out+out_idx, &u32, 4);
2284
2209
  out_idx += 4;
2285
2210
  break;
2286
2211
 
2287
- case DATATYPE_BIGINT:
2212
+ case MYSQL_TYPE_LONGLONG:
2288
2213
  CHECKMEM(8);
2289
2214
  i64 = (is_null) ? 0 : (int64_t)PyLong_AsLongLong(py_item);
2290
2215
  memcpy(out+out_idx, &i64, 8);
2291
2216
  out_idx += 8;
2292
2217
  break;
2293
2218
 
2294
- case DATATYPE_UNSIGNED_BIGINT:
2219
+ // Use negative to indicate unsigned
2220
+ case -MYSQL_TYPE_LONGLONG:
2295
2221
  CHECKMEM(8);
2296
2222
  u64 = (is_null) ? 0 : (uint64_t)PyLong_AsUnsignedLongLong(py_item);
2297
2223
  memcpy(out+out_idx, &u64, 8);
2298
2224
  out_idx += 8;
2299
2225
  break;
2300
2226
 
2301
- case DATATYPE_FLOAT:
2227
+ case MYSQL_TYPE_FLOAT:
2302
2228
  CHECKMEM(4);
2303
2229
  flt = (is_null) ? 0 : (float)PyFloat_AsDouble(py_item);
2304
2230
  memcpy(out+out_idx, &flt, 4);
2305
2231
  out_idx += 4;
2306
2232
  break;
2307
2233
 
2308
- case DATATYPE_DOUBLE:
2309
- //case DATATYPE_REAL:
2234
+ case MYSQL_TYPE_DOUBLE:
2310
2235
  CHECKMEM(8);
2311
2236
  dbl = (is_null) ? 0 : (double)PyFloat_AsDouble(py_item);
2312
2237
  memcpy(out+out_idx, &dbl, 8);
2313
2238
  out_idx += 8;
2314
2239
  break;
2315
2240
 
2316
- case DATATYPE_DECIMAL:
2317
- //case DATATYPE_DEC:
2318
- //case DATATYPE_FIXED:
2319
- //case DATATYPE_NUMERIC:
2320
- // TODO
2321
- break;
2322
-
2323
- case DATATYPE_DATE:
2241
+ case MYSQL_TYPE_DECIMAL:
2324
2242
  // TODO
2325
2243
  break;
2326
2244
 
2327
- case DATATYPE_TIME:
2245
+ case MYSQL_TYPE_DATE:
2246
+ case MYSQL_TYPE_NEWDATE:
2328
2247
  // TODO
2329
2248
  break;
2330
2249
 
2331
- case DATATYPE_TIME_6:
2250
+ case MYSQL_TYPE_TIME:
2332
2251
  // TODO
2333
2252
  break;
2334
2253
 
2335
- case DATATYPE_DATETIME:
2254
+ case MYSQL_TYPE_DATETIME:
2336
2255
  // TODO
2337
2256
  break;
2338
2257
 
2339
- case DATATYPE_DATETIME_6:
2258
+ case MYSQL_TYPE_TIMESTAMP:
2340
2259
  // TODO
2341
2260
  break;
2342
2261
 
2343
- case DATATYPE_TIMESTAMP:
2344
- // TODO
2345
- break;
2346
-
2347
- case DATATYPE_TIMESTAMP_6:
2348
- // TODO
2349
- break;
2350
-
2351
- case DATATYPE_YEAR:
2262
+ case MYSQL_TYPE_YEAR:
2352
2263
  CHECKMEM(2);
2353
2264
  i16 = (is_null) ? 0 : (int16_t)PyLong_AsLong(py_item);
2354
2265
  memcpy(out+out_idx, &i16, 2);
2355
2266
  out_idx += 2;
2356
2267
  break;
2357
2268
 
2358
- case DATATYPE_CHAR:
2359
- case DATATYPE_VARCHAR:
2360
- case DATATYPE_LONGTEXT:
2361
- case DATATYPE_MEDIUMTEXT:
2362
- case DATATYPE_TEXT:
2363
- case DATATYPE_TINYTEXT:
2364
- case DATATYPE_JSON:
2365
- case DATATYPE_GEOGRAPHYPOINT:
2366
- case DATATYPE_GEOGRAPHY:
2269
+ case MYSQL_TYPE_VARCHAR:
2270
+ case MYSQL_TYPE_JSON:
2271
+ case MYSQL_TYPE_SET:
2272
+ case MYSQL_TYPE_ENUM:
2273
+ case MYSQL_TYPE_VAR_STRING:
2274
+ case MYSQL_TYPE_STRING:
2275
+ case MYSQL_TYPE_GEOMETRY:
2276
+ case MYSQL_TYPE_TINY_BLOB:
2277
+ case MYSQL_TYPE_MEDIUM_BLOB:
2278
+ case MYSQL_TYPE_LONG_BLOB:
2279
+ case MYSQL_TYPE_BLOB:
2367
2280
  {
2368
2281
  PyObject *py_bytes = PyUnicode_AsEncodedString(py_item, "utf-8", "strict");
2369
2282
  if (!py_bytes) goto error;
@@ -2385,12 +2298,18 @@ static PyObject *dump_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2385
2298
  }
2386
2299
  break;
2387
2300
 
2388
- case DATATYPE_BINARY:
2389
- case DATATYPE_VARBINARY:
2390
- case DATATYPE_LONGBLOB:
2391
- case DATATYPE_MEDIUMBLOB:
2392
- case DATATYPE_BLOB:
2393
- case DATATYPE_TINYBLOB:
2301
+ // Use negative to indicate binary
2302
+ case -MYSQL_TYPE_VARCHAR:
2303
+ case -MYSQL_TYPE_JSON:
2304
+ case -MYSQL_TYPE_SET:
2305
+ case -MYSQL_TYPE_ENUM:
2306
+ case -MYSQL_TYPE_VAR_STRING:
2307
+ case -MYSQL_TYPE_STRING:
2308
+ case -MYSQL_TYPE_GEOMETRY:
2309
+ case -MYSQL_TYPE_TINY_BLOB:
2310
+ case -MYSQL_TYPE_MEDIUM_BLOB:
2311
+ case -MYSQL_TYPE_LONG_BLOB:
2312
+ case -MYSQL_TYPE_BLOB:
2394
2313
  {
2395
2314
  char *str = NULL;
2396
2315
  Py_ssize_t str_l = 0;
@@ -2407,11 +2326,6 @@ static PyObject *dump_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
2407
2326
  }
2408
2327
  break;
2409
2328
 
2410
- case DATATYPE_ARRAY:
2411
- case DATATYPE_RECORD:
2412
- // TODO
2413
- break;
2414
-
2415
2329
  default:
2416
2330
  goto error;
2417
2331
  }
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = singlestoredb
3
- version = 0.8.8
3
+ version = 0.9.0
4
4
  description = Interface to the SingleStoreDB database and workspace management APIs
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '0.8.8'
16
+ __version__ = '0.9.0'
17
17
 
18
18
  from .alchemy import create_engine
19
19
  from .config import options, get_option, set_option, describe_option
@@ -250,3 +250,9 @@ register_option(
250
250
  'Print queries and parameters to stderr.',
251
251
  environ='SINGLESTOREDB_DEBUG_QUERIES',
252
252
  )
253
+
254
+ register_option(
255
+ 'debug.connection', 'bool', check_bool, False,
256
+ 'Print connection tracing information.',
257
+ environ='SINGLESTOREDB_DEBUG_CONNECTION',
258
+ )
@@ -94,3 +94,27 @@ class NotSupportedError(DatabaseError):
94
94
 
95
95
  class ManagementError(Error):
96
96
  """Exception for errors in the management API."""
97
+
98
+ def __init__(
99
+ self, errno: Optional[int] = None, msg: Optional[str] = None,
100
+ response: Optional[str] = None,
101
+ ):
102
+ self.errno = errno
103
+ self.errmsg = msg
104
+ self.response = response
105
+ super(Exception, self).__init__(errno, msg)
106
+
107
+ def __str__(self) -> str:
108
+ """Return string representation."""
109
+ prefix = []
110
+ if self.errno is not None:
111
+ prefix.append(f'{self.errno}')
112
+ if self.response is not None:
113
+ prefix.append(f'({self.response})')
114
+ if prefix and self.errmsg:
115
+ return ' '.join(prefix) + ': ' + self.errmsg
116
+ elif prefix:
117
+ return ' '.join(prefix)
118
+ elif self.errmsg:
119
+ return f'{self.errmsg}'
120
+ return 'Unknown error'
@@ -0,0 +1 @@
1
+ from .decorator import udf # noqa: F401