singlestoredb 1.0.3__cp38-abi3-win32.whl → 1.1.0__cp38-abi3-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

Files changed (31) hide show
  1. _singlestoredb_accel.pyd +0 -0
  2. singlestoredb/__init__.py +1 -1
  3. singlestoredb/config.py +125 -0
  4. singlestoredb/functions/dtypes.py +5 -198
  5. singlestoredb/functions/ext/__init__.py +0 -1
  6. singlestoredb/functions/ext/asgi.py +665 -153
  7. singlestoredb/functions/ext/json.py +2 -2
  8. singlestoredb/functions/ext/mmap.py +174 -67
  9. singlestoredb/functions/ext/rowdat_1.py +2 -2
  10. singlestoredb/functions/ext/utils.py +169 -0
  11. singlestoredb/fusion/handler.py +109 -9
  12. singlestoredb/fusion/handlers/stage.py +150 -0
  13. singlestoredb/fusion/handlers/workspace.py +265 -4
  14. singlestoredb/fusion/registry.py +69 -1
  15. singlestoredb/http/connection.py +40 -2
  16. singlestoredb/management/utils.py +30 -0
  17. singlestoredb/management/workspace.py +209 -35
  18. singlestoredb/mysql/connection.py +69 -0
  19. singlestoredb/mysql/cursors.py +176 -4
  20. singlestoredb/tests/test.sql +210 -0
  21. singlestoredb/tests/test_connection.py +1408 -0
  22. singlestoredb/tests/test_ext_func.py +2 -2
  23. singlestoredb/tests/test_ext_func_data.py +1 -1
  24. singlestoredb/utils/dtypes.py +205 -0
  25. singlestoredb/utils/results.py +367 -14
  26. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/METADATA +2 -1
  27. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/RECORD +31 -29
  28. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/LICENSE +0 -0
  29. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/WHEEL +0 -0
  30. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/entry_points.txt +0 -0
  31. {singlestoredb-1.0.3.dist-info → singlestoredb-1.1.0.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,9 @@ from collections import namedtuple
4
4
 
5
5
  from . import err
6
6
  from ..connection import Cursor as BaseCursor
7
+ from ..utils import results
7
8
  from ..utils.debug import log_query
9
+ from ..utils.results import get_schema
8
10
 
9
11
 
10
12
  #: Regular expression for :meth:`Cursor.executemany`.
@@ -45,6 +47,7 @@ class Cursor(BaseCursor):
45
47
  self._connection = connection
46
48
  self.warning_count = 0
47
49
  self._description = None
50
+ self._format_schema = None
48
51
  self._rownumber = 0
49
52
  self.rowcount = -1
50
53
  self.arraysize = 1
@@ -62,6 +65,10 @@ class Cursor(BaseCursor):
62
65
  def description(self):
63
66
  return self._description
64
67
 
68
+ @property
69
+ def _schema(self):
70
+ return self._format_schema
71
+
65
72
  @property
66
73
  def connection(self):
67
74
  return self._connection
@@ -394,6 +401,7 @@ class Cursor(BaseCursor):
394
401
  self.rowcount = 0
395
402
  self.warning_count = 0
396
403
  self._description = None
404
+ self._format_schema = None
397
405
  self.lastrowid = None
398
406
  self._rows = None
399
407
 
@@ -409,6 +417,10 @@ class Cursor(BaseCursor):
409
417
  if self.rowcount == 18446744073709551615:
410
418
  self.rowcount = -1
411
419
  self._description = result.description
420
+ self._format_schema = get_schema(
421
+ self.connection._results_type,
422
+ result.description,
423
+ )
412
424
  self.lastrowid = result.insert_id
413
425
  self._rows = result.rows
414
426
 
@@ -440,6 +452,134 @@ class CursorSV(Cursor):
440
452
  """Cursor class for C extension."""
441
453
 
442
454
 
455
+ class ArrowCursorMixin:
456
+ """Fetch methods for Arrow Tables."""
457
+
458
+ def fetchone(self):
459
+ return results.results_to_arrow(
460
+ self.description, super().fetchone(), single=True, schema=self._schema,
461
+ )
462
+
463
+ def fetchall(self):
464
+ return results.results_to_arrow(
465
+ self.description, super().fetchall(), schema=self._schema,
466
+ )
467
+
468
+ def fetchall_unbuffered(self):
469
+ return results.results_to_arrow(
470
+ self.description, super().fetchall_unbuffered(), schema=self._schema,
471
+ )
472
+
473
+ def fetchmany(self, size=None):
474
+ return results.results_to_arrow(
475
+ self.description, super().fetchmany(size), schema=self._schema,
476
+ )
477
+
478
+
479
+ class ArrowCursor(ArrowCursorMixin, Cursor):
480
+ """A cursor which returns results as an Arrow Table."""
481
+
482
+
483
+ class ArrowCursorSV(ArrowCursorMixin, CursorSV):
484
+ """A cursor which returns results as an Arrow Table for C extension."""
485
+
486
+
487
+ class NumpyCursorMixin:
488
+ """Fetch methods for numpy arrays."""
489
+
490
+ def fetchone(self):
491
+ return results.results_to_numpy(
492
+ self.description, super().fetchone(), single=True, schema=self._schema,
493
+ )
494
+
495
+ def fetchall(self):
496
+ return results.results_to_numpy(
497
+ self.description, super().fetchall(), schema=self._schema,
498
+ )
499
+
500
+ def fetchall_unbuffered(self):
501
+ return results.results_to_numpy(
502
+ self.description, super().fetchall_unbuffered(), schema=self._schema,
503
+ )
504
+
505
+ def fetchmany(self, size=None):
506
+ return results.results_to_numpy(
507
+ self.description, super().fetchmany(size), schema=self._schema,
508
+ )
509
+
510
+
511
+ class NumpyCursor(NumpyCursorMixin, Cursor):
512
+ """A cursor which returns results as a numpy array."""
513
+
514
+
515
+ class NumpyCursorSV(NumpyCursorMixin, CursorSV):
516
+ """A cursor which returns results as a numpy array for C extension."""
517
+
518
+
519
+ class PandasCursorMixin:
520
+ """Fetch methods for pandas DataFrames."""
521
+
522
+ def fetchone(self):
523
+ return results.results_to_pandas(
524
+ self.description, super().fetchone(), single=True, schema=self._schema,
525
+ )
526
+
527
+ def fetchall(self):
528
+ return results.results_to_pandas(
529
+ self.description, super().fetchall(), schema=self._schema,
530
+ )
531
+
532
+ def fetchall_unbuffered(self):
533
+ return results.results_to_pandas(
534
+ self.description, super().fetchall_unbuffered(), schema=self._schema,
535
+ )
536
+
537
+ def fetchmany(self, size=None):
538
+ return results.results_to_pandas(
539
+ self.description, super().fetchmany(size), schema=self._schema,
540
+ )
541
+
542
+
543
+ class PandasCursor(PandasCursorMixin, Cursor):
544
+ """A cursor which returns results as a pandas DataFrame."""
545
+
546
+
547
+ class PandasCursorSV(PandasCursorMixin, CursorSV):
548
+ """A cursor which returns results as a pandas DataFrame for C extension."""
549
+
550
+
551
+ class PolarsCursorMixin:
552
+ """Fetch methods for polars DataFrames."""
553
+
554
+ def fetchone(self):
555
+ return results.results_to_polars(
556
+ self.description, super().fetchone(), single=True, schema=self._schema,
557
+ )
558
+
559
+ def fetchall(self):
560
+ return results.results_to_polars(
561
+ self.description, super().fetchall(), schema=self._schema,
562
+ )
563
+
564
+ def fetchall_unbuffered(self):
565
+ return results.results_to_polars(
566
+ self.description, super().fetchall_unbuffered(), schema=self._schema,
567
+ )
568
+
569
+ def fetchmany(self, size=None):
570
+ return results.results_to_polars(
571
+ self.description, super().fetchmany(size), schema=self._schema,
572
+ )
573
+
574
+
575
+ class PolarsCursor(PolarsCursorMixin, Cursor):
576
+ """A cursor which returns results as a polars DataFrame."""
577
+
578
+
579
+ class PolarsCursorSV(PolarsCursorMixin, CursorSV):
580
+ """A cursor which returns results as a polars DataFrame for C extension."""
581
+
582
+
443
583
  class DictCursorMixin:
444
584
  # You can override this to use OrderedDict or other dict-like types.
445
585
  dict_type = dict
@@ -698,16 +838,48 @@ class SSCursorSV(SSCursor):
698
838
 
699
839
 
700
840
  class SSDictCursor(DictCursorMixin, SSCursor):
701
- """An unbuffered cursor, which returns results as a dictionary"""
841
+ """An unbuffered cursor, which returns results as a dictionary."""
702
842
 
703
843
 
704
844
  class SSDictCursorSV(SSCursorSV):
705
- """An unbuffered cursor for the C extension, which returns a dictionary"""
845
+ """An unbuffered cursor for the C extension, which returns a dictionary."""
706
846
 
707
847
 
708
848
  class SSNamedtupleCursor(NamedtupleCursorMixin, SSCursor):
709
- """An unbuffered cursor, which returns results as a named tuple"""
849
+ """An unbuffered cursor, which returns results as a named tuple."""
710
850
 
711
851
 
712
852
  class SSNamedtupleCursorSV(SSCursorSV):
713
- """An unbuffered cursor for the C extension, which returns results as a named tuple"""
853
+ """An unbuffered cursor for the C extension, which returns results as named tuple."""
854
+
855
+
856
+ class SSArrowCursor(ArrowCursorMixin, SSCursor):
857
+ """An unbuffered cursor, which returns results as an Arrow Table."""
858
+
859
+
860
+ class SSArrowCursorSV(ArrowCursorMixin, SSCursorSV):
861
+ """An unbuffered cursor, which returns results as an Arrow Table (accelerated)."""
862
+
863
+
864
+ class SSNumpyCursor(NumpyCursorMixin, SSCursor):
865
+ """An unbuffered cursor, which returns results as a numpy array."""
866
+
867
+
868
+ class SSNumpyCursorSV(NumpyCursorMixin, SSCursorSV):
869
+ """An unbuffered cursor, which returns results as a numpy array (accelerated)."""
870
+
871
+
872
+ class SSPandasCursor(PandasCursorMixin, SSCursor):
873
+ """An unbuffered cursor, which returns results as a pandas DataFrame."""
874
+
875
+
876
+ class SSPandasCursorSV(PandasCursorMixin, SSCursorSV):
877
+ """An unbuffered cursor, which returns results as a pandas DataFrame (accelerated)."""
878
+
879
+
880
+ class SSPolarsCursor(PolarsCursorMixin, SSCursor):
881
+ """An unbuffered cursor, which returns results as a polars DataFrame."""
882
+
883
+
884
+ class SSPolarsCursorSV(PolarsCursorMixin, SSCursorSV):
885
+ """An unbuffered cursor, which returns results as a polars DataFrame (accelerated)."""
@@ -363,6 +363,216 @@ INSERT INTO alltypes SET
363
363
  ;
364
364
 
365
365
 
366
+ CREATE TABLE IF NOT EXISTS alltypes_no_nulls (
367
+ `id` INT(11) NOT NULL,
368
+ `tinyint` TINYINT NOT NULL,
369
+ `unsigned_tinyint` TINYINT UNSIGNED NOT NULL,
370
+ `bool` BOOL NOT NULL,
371
+ `boolean` BOOLEAN NOT NULL,
372
+ `smallint` SMALLINT NOT NULL,
373
+ `unsigned_smallint` SMALLINT UNSIGNED NOT NULL,
374
+ `mediumint` MEDIUMINT NOT NULL,
375
+ `unsigned_mediumint` MEDIUMINT UNSIGNED NOT NULL,
376
+ `int24` MEDIUMINT NOT NULL,
377
+ `unsigned_int24` MEDIUMINT UNSIGNED NOT NULL,
378
+ `int` INT NOT NULL,
379
+ `unsigned_int` INT UNSIGNED NOT NULL,
380
+ `integer` INTEGER NOT NULL,
381
+ `unsigned_integer` INTEGER UNSIGNED NOT NULL,
382
+ `bigint` BIGINT NOT NULL,
383
+ `unsigned_bigint` BIGINT UNSIGNED NOT NULL,
384
+ `float` FLOAT NOT NULL,
385
+ `double` DOUBLE NOT NULL,
386
+ `real` REAL NOT NULL,
387
+ `decimal` DECIMAL(20,6) NOT NULL,
388
+ `dec` DEC(20,6) NOT NULL,
389
+ `fixed` FIXED(20,6) NOT NULL,
390
+ `numeric` NUMERIC(20,6) NOT NULL,
391
+ `date` DATE NOT NULL,
392
+ `time` TIME NOT NULL,
393
+ `time_6` TIME(6) NOT NULL,
394
+ `datetime` DATETIME NOT NULL,
395
+ `datetime_6` DATETIME(6) NOT NULL,
396
+ `timestamp` TIMESTAMP NOT NULL,
397
+ `timestamp_6` TIMESTAMP(6) NOT NULL,
398
+ `year` YEAR NOT NULL,
399
+ `char_100` CHAR(100) NOT NULL,
400
+ `binary_100` BINARY(100) NOT NULL,
401
+ `varchar_200` VARCHAR(200) NOT NULL,
402
+ `varbinary_200` VARBINARY(200) NOT NULL,
403
+ `longtext` LONGTEXT NOT NULL,
404
+ `mediumtext` MEDIUMTEXT NOT NULL,
405
+ `text` TEXT NOT NULL,
406
+ `tinytext` TINYTEXT NOT NULL,
407
+ `longblob` LONGBLOB NOT NULL,
408
+ `mediumblob` MEDIUMBLOB NOT NULL,
409
+ `blob` BLOB NOT NULL,
410
+ `tinyblob` TINYBLOB NOT NULL,
411
+ `json` JSON NOT NULL,
412
+ -- `geographypoint` GEOGRAPHYPOINT NOT NULL,
413
+ -- `geography` GEOGRAPHY NOT NULL,
414
+ `enum` ENUM('one', 'two', 'three') NOT NULL,
415
+ `set` SET('one', 'two', 'three') NOT NULL,
416
+ `bit` BIT NOT NULL
417
+ )
418
+ COLLATE='utf8_unicode_ci';
419
+
420
+ INSERT INTO alltypes_no_nulls SET
421
+ `id`=0,
422
+ `tinyint`=80,
423
+ `unsigned_tinyint`=85,
424
+ `bool`=0,
425
+ `boolean`=1,
426
+ `smallint`=-27897,
427
+ `unsigned_smallint`=27897,
428
+ `mediumint`=104729,
429
+ `unsigned_mediumint`=120999,
430
+ `int24`=-200899,
431
+ `unsigned_int24`=407709,
432
+ `int`=-1295369311,
433
+ `unsigned_int`=3872362332,
434
+ `integer`=-1741727421,
435
+ `unsigned_integer`=3198387363,
436
+ `bigint`=-266883847,
437
+ `unsigned_bigint`=980007287362,
438
+ `float`=-146486683.754744,
439
+ `double`=-474646154.719356,
440
+ `real`=-901409776.279346,
441
+ `decimal`=28111097.610822,
442
+ `dec`=389451155.931428,
443
+ `fixed`=-143773416.044092,
444
+ `numeric`=866689461.300046,
445
+ `date`='8524-11-10',
446
+ `time`='00:07:00',
447
+ `time_6`='01:10:00.000002',
448
+ `datetime`='9948-03-11 15:29:22',
449
+ `datetime_6`='1756-10-29 02:02:42.000008',
450
+ `timestamp`='1980-12-31 01:10:23',
451
+ `timestamp_6`='1991-01-02 22:15:10.000006',
452
+ `year`=1923,
453
+ `char_100`='This is a test of a 100 character column.',
454
+ `binary_100`=x'000102030405060708090A0B0C0D0E0F',
455
+ `varchar_200`='This is a test of a variable character column.',
456
+ `varbinary_200`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
457
+ `longtext`='This is a longtext column.',
458
+ `mediumtext`='This is a mediumtext column.',
459
+ `text`='This is a text column.',
460
+ `tinytext`='This is a tinytext column.',
461
+ `longblob`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
462
+ `mediumblob`=x'000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F',
463
+ `blob`=x'000102030405060708090A0B0C0D0E0F',
464
+ `tinyblob`=x'0A0B0C0D0E0F',
465
+ `json`='{"a": 10, "b": 2.75, "c": "hello world"}',
466
+ `enum`='one',
467
+ `set`='two',
468
+ `bit`=128
469
+ ;
470
+
471
+ -- Minimum values
472
+ INSERT INTO alltypes_no_nulls SET
473
+ `id`=2,
474
+ `tinyint`=-128,
475
+ `unsigned_tinyint`=0,
476
+ `bool`=-128,
477
+ `boolean`=-128,
478
+ `smallint`=-32768,
479
+ `unsigned_smallint`=0,
480
+ `mediumint`=-8388608,
481
+ `unsigned_mediumint`=0,
482
+ `int24`=-8388608,
483
+ `unsigned_int24`=0,
484
+ `int`=-2147483648,
485
+ `unsigned_int`=0,
486
+ `integer`=-2147483648,
487
+ `unsigned_integer`=0,
488
+ `bigint`=-9223372036854775808,
489
+ `unsigned_bigint`=0,
490
+ `float`=0,
491
+ `double`=-1.7976931348623158e308,
492
+ `real`=-1.7976931348623158e308,
493
+ `decimal`=-99999999999999.999999,
494
+ `dec`=-99999999999999.999999,
495
+ `fixed`=-99999999999999.999999,
496
+ `numeric`=-99999999999999.999999,
497
+ `date`='1000-01-01',
498
+ `time`='-838:59:59',
499
+ `time_6`='-838:59:59.000000',
500
+ `datetime`='1000-01-01 00:00:00',
501
+ `datetime_6`='1000-01-01 00:00:00.000000',
502
+ `timestamp`='1970-01-01 00:00:01',
503
+ `timestamp_6`='1970-01-01 00:00:01.000000',
504
+ `year`=1901,
505
+ `char_100`='',
506
+ `binary_100`=x'',
507
+ `varchar_200`='',
508
+ `varbinary_200`=x'',
509
+ `longtext`='',
510
+ `mediumtext`='',
511
+ `text`='',
512
+ `tinytext`='',
513
+ `longblob`=x'',
514
+ `mediumblob`=x'',
515
+ `blob`=x'',
516
+ `tinyblob`=x'',
517
+ `json`='{}',
518
+ `enum`='one',
519
+ `set`='two',
520
+ `bit`=0
521
+ ;
522
+
523
+ -- Maximum values
524
+ INSERT INTO alltypes_no_nulls SET
525
+ `id`=3,
526
+ `tinyint`=127,
527
+ `unsigned_tinyint`=255,
528
+ `bool`=127,
529
+ `boolean`=127,
530
+ `smallint`=32767,
531
+ `unsigned_smallint`=65535,
532
+ `mediumint`=8388607,
533
+ `unsigned_mediumint`=16777215,
534
+ `int24`=8388607,
535
+ `unsigned_int24`=16777215,
536
+ `int`=2147483647,
537
+ `unsigned_int`=4294967295,
538
+ `integer`=2147483647,
539
+ `unsigned_integer`=4294967295,
540
+ `bigint`=9223372036854775807,
541
+ `unsigned_bigint`=18446744073709551615,
542
+ `float`=0,
543
+ `double`=1.7976931348623158e308,
544
+ `real`=1.7976931348623158e308,
545
+ `decimal`=99999999999999.999999,
546
+ `dec`=99999999999999.999999,
547
+ `fixed`=99999999999999.999999,
548
+ `numeric`=99999999999999.999999,
549
+ `date`='9999-12-31',
550
+ `time`='838:59:59',
551
+ `time_6`='838:59:59.999999',
552
+ `datetime`='9999-12-31 23:59:59',
553
+ `datetime_6`='9999-12-31 23:59:59.999999',
554
+ `timestamp`='2038-01-18 21:14:07',
555
+ `timestamp_6`='2038-01-18 21:14:07.999999',
556
+ `year`=2155,
557
+ `char_100`='',
558
+ `binary_100`=x'',
559
+ `varchar_200`='',
560
+ `varbinary_200`=x'',
561
+ `longtext`='',
562
+ `mediumtext`='',
563
+ `text`='',
564
+ `tinytext`='',
565
+ `longblob`=x'',
566
+ `mediumblob`=x'',
567
+ `blob`=x'',
568
+ `tinyblob`=x'',
569
+ `json`='{}',
570
+ `enum`='one',
571
+ `set`='two',
572
+ `bit`=18446744073709551615
573
+ ;
574
+
575
+
366
576
  --
367
577
  -- Table of extended data types
368
578
  --