13
13
from sqlalchemy .testing .suite import LongNameBlowoutTest as _LongNameBlowoutTest
14
14
from sqlalchemy .testing .suite import QuotedNameArgumentTest as _QuotedNameArgumentTest
15
15
from sqlalchemy .testing .suite import JoinTest as _JoinTest
16
+ from sqlalchemy .testing .suite import HasSequenceTest as _HasSequenceTest
16
17
17
18
from sqlalchemy .testing .suite import ServerSideCursorsTest as _ServerSideCursorsTest
18
19
21
22
from sqlalchemy .testing .suite import IntegerTest as _IntegerTest
22
23
23
24
from sqlalchemy import types as sql_types
24
- from sqlalchemy .testing import config
25
+ from sqlalchemy .testing import config , skip_test
25
26
from sqlalchemy import testing , Table , Column , Integer
26
27
from sqlalchemy .testing import eq_ , fixtures , assertions
27
28
@@ -586,9 +587,6 @@ def test_geometry_write_and_read(self, connection):
586
587
eq_ (result , ('{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [10,20]},{"type": "LineString", "coordinates": [[10,20],[30,40]]},{"type": "Polygon", "coordinates": [[[10,20],[30,40],[50,60],[10,20]]]}]}' ))
587
588
588
589
589
-
590
-
591
-
592
590
class GeographyTest (fixtures .TablesTest ):
593
591
594
592
@classmethod
@@ -664,4 +662,74 @@ def test_geography_write_and_read(self, connection):
664
662
result = connection .execute (
665
663
select (geography_table .c .geography_data ).where (geography_table .c .id == 7 )
666
664
).scalar ()
667
- eq_ (result , ('{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [10,20]},{"type": "LineString", "coordinates": [[10,20],[30,40]]},{"type": "Polygon", "coordinates": [[[10,20],[30,40],[50,60],[10,20]]]}]}' ))
665
+ eq_ (result , ('{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [10,20]},{"type": "LineString", "coordinates": [[10,20],[30,40]]},{"type": "Polygon", "coordinates": [[[10,20],[30,40],[50,60],[10,20]]]}]}' ))
666
+
667
+
668
+ class HasSequenceTest (_HasSequenceTest ):
669
+
670
+ # ToDo - overridden other_seq definition due to lack of sequence ddl support for nominvalue nomaxvalue
671
+ @classmethod
672
+ def define_tables (cls , metadata ):
673
+ normalize_sequence (config , Sequence ("user_id_seq" , metadata = metadata ))
674
+ normalize_sequence (
675
+ config ,
676
+ Sequence (
677
+ "other_seq" ,
678
+ metadata = metadata ,
679
+ # nomaxvalue=True,
680
+ # nominvalue=True,
681
+ ),
682
+ )
683
+ if testing .requires .schemas .enabled :
684
+ #ToDo - omitted because Databend does not allow schema on sequence
685
+ # normalize_sequence(
686
+ # config,
687
+ # Sequence(
688
+ # "user_id_seq", schema=config.test_schema, metadata=metadata
689
+ # ),
690
+ # )
691
+ normalize_sequence (
692
+ config ,
693
+ Sequence (
694
+ "schema_seq" , schema = config .test_schema , metadata = metadata
695
+ ),
696
+ )
697
+ Table (
698
+ "user_id_table" ,
699
+ metadata ,
700
+ Column ("id" , Integer , primary_key = True ),
701
+ )
702
+
703
+ @testing .skip ("databend" ) # ToDo - requires definition of sequences with schema
704
+ def test_has_sequence_remote_not_in_default (self , connection ):
705
+ eq_ (inspect (connection ).has_sequence ("schema_seq" ), False )
706
+
707
+ @testing .skip ("databend" ) # ToDo - requires definition of sequences with schema
708
+ def test_get_sequence_names (self , connection ):
709
+ exp = {"other_seq" , "user_id_seq" }
710
+
711
+ res = set (inspect (connection ).get_sequence_names ())
712
+ is_true (res .intersection (exp ) == exp )
713
+ is_true ("schema_seq" not in res )
714
+
715
+ @testing .skip ("databend" ) # ToDo - requires definition of sequences with schema
716
+ @testing .requires .schemas
717
+ def test_get_sequence_names_no_sequence_schema (self , connection ):
718
+ eq_ (
719
+ inspect (connection ).get_sequence_names (
720
+ schema = config .test_schema_2
721
+ ),
722
+ [],
723
+ )
724
+
725
+ @testing .skip ("databend" ) # ToDo - requires definition of sequences with schema
726
+ @testing .requires .schemas
727
+ def test_get_sequence_names_sequences_schema (self , connection ):
728
+ eq_ (
729
+ sorted (
730
+ inspect (connection ).get_sequence_names (
731
+ schema = config .test_schema
732
+ )
733
+ ),
734
+ ["schema_seq" , "user_id_seq" ],
735
+ )
0 commit comments