@@ -777,8 +777,7 @@ def test_async_index(self, connection: sa.Connection, metadata: sa.MetaData):
777777 index = indexes [0 ]
778778 assert index .name == "test_async_index"
779779 assert set (index .index_columns ) == {"index_col1" , "index_col2" }
780- # TODO: Uncomment after fix https://github.com/ydb-platform/ydb-python-sdk/issues/351
781- # assert index.to_pb().WhichOneof("type") == "global_async_index"
780+ # TODO: Check type after https://github.com/ydb-platform/ydb-python-sdk/issues/351
782781
783782 def test_cover_index (self , connection : sa .Connection , metadata : sa .MetaData ):
784783 table = Table (
@@ -797,3 +796,30 @@ def test_cover_index(self, connection: sa.Connection, metadata: sa.MetaData):
797796 index = indexes [0 ]
798797 assert index .name == "test_cover_index"
799798 assert set (index .index_columns ) == {"index_col1" }
799+ # TODO: Check covered columns after https://github.com/ydb-platform/ydb-python-sdk/issues/409
800+
801+ def test_indexes_reflection (self , connection : sa .Connection , metadata : sa .MetaData ):
802+ table = Table (
803+ "test_indexes_reflection/table" ,
804+ metadata ,
805+ sa .Column ("id" , sa .Integer , primary_key = True ),
806+ sa .Column ("index_col1" , sa .Integer , index = True ),
807+ sa .Column ("index_col2" , sa .Integer ),
808+ sa .Index ("test_index" , "index_col1" , "index_col2" ),
809+ sa .Index ("test_async_index" , "index_col1" , "index_col2" , ydb_async = True ),
810+ sa .Index ("test_cover_index" , "index_col1" , ydb_cover = ["index_col2" ]),
811+ sa .Index ("test_async_cover_index" , "index_col1" , ydb_async = True , ydb_cover = ["index_col2" ]),
812+ )
813+ table .create (connection )
814+
815+ indexes = sa .inspect (connection ).get_indexes (table .name )
816+ assert len (indexes ) == 5
817+ indexes_names = {idx ["name" ]: set (idx ["column_names" ]) for idx in indexes }
818+
819+ assert indexes_names == {
820+ "ix_test_indexes_reflection_table_index_col1" : {"index_col1" },
821+ "test_index" : {"index_col1" , "index_col2" },
822+ "test_async_index" : {"index_col1" , "index_col2" },
823+ "test_cover_index" : {"index_col1" },
824+ "test_async_cover_index" : {"index_col1" },
825+ }
0 commit comments