@@ -35,38 +35,40 @@ def test_uuid_type_mapping(self):
3535 def test_uuid_designate_type (self ):
3636 """Test reflecting UUID type string returns types.UUID."""
3737 dialect = SpannerDialect ()
38- assert dialect .supports_native_uuid is True
38+ assert dialect .supports_native_uuid is False
3939 col_type = dialect ._designate_type ("UUID" )
4040 eq_ (col_type , types .UUID )
4141
4242 def test_uuid_ddl_compilation_default (self ):
43- """Test DDL compilation emits UUID type by default when supports_native_uuid
44- is True .
43+ """Test DDL compilation: types.Uuid emits STRING(36) by default and
44+ types.UUID emits UUID by default .
4545 """
4646 dialect = SpannerDialect ()
4747 metadata = MetaData ()
4848 table = Table (
4949 "test_uuid_table" ,
5050 metadata ,
51- Column ("user_id" , types .Uuid , primary_key = True ),
51+ Column ("legacy_id" , types .Uuid , primary_key = True ),
52+ Column ("native_id" , types .UUID ),
5253 )
5354 statement = str (CreateTable (table ).compile (dialect = dialect )).strip ()
54- assert "user_id UUID NOT NULL" in statement
55+ assert "legacy_id STRING(36) NOT NULL" in statement
56+ assert "native_id UUID" in statement
5557
56- def test_uuid_ddl_compilation_native_disabled (self ):
57- """Test DDL compilation falls back to STRING(36) when supports_native_uuid
58- is False .
58+ def test_uuid_ddl_compilation_native_enabled (self ):
59+ """Test DDL compilation emits UUID type for types.Uuid when supports_native_uuid
60+ is set to True on dialect .
5961 """
6062 dialect = SpannerDialect ()
61- dialect .supports_native_uuid = False
63+ dialect .supports_native_uuid = True
6264 metadata = MetaData ()
6365 table = Table (
6466 "test_uuid_table" ,
6567 metadata ,
6668 Column ("user_id" , types .Uuid , primary_key = True ),
6769 )
6870 statement = str (CreateTable (table ).compile (dialect = dialect )).strip ()
69- assert "user_id STRING(36) NOT NULL" in statement
71+ assert "user_id UUID NOT NULL" in statement
7072
7173 def test_uuid_python_conversion_legacy (self ):
7274 """Test that types.Uuid automatically converts uuid.UUID to/from str
0 commit comments