diff --git a/test/test_suite.py b/test/test_suite.py index 032e93d..e0e8550 100644 --- a/test/test_suite.py +++ b/test/test_suite.py @@ -577,6 +577,19 @@ def test_from_as_table(self, connection): eq_(connection.execute(sa.select(table)).fetchall(), [(1,), (2,), (3,)]) + def test_tuple_list_type_bind_variable_text(self, connection): + table = self.tables.container_types_test + + connection.execute(sa.insert(table).values([{"id": 1}, {"id": 2}, {"id": 3}])) + + stmt = select(table.c.id).where( + sa.text("(id, id) IN :tuple_arr_var").bindparams( + sa.bindparam("tuple_arr_var", type_=sa.ARRAY(sa.TupleType(sa.Integer, sa.Integer))), + ) + ) + + eq_(connection.execute(stmt, {"tuple_arr_var": [(1, 1), (2, 2)]}).fetchall(), [(1,), (2,)]) + class ConcatTest(fixtures.TablesTest): @classmethod diff --git a/ydb_sqlalchemy/sqlalchemy/compiler/base.py b/ydb_sqlalchemy/sqlalchemy/compiler/base.py index e7514fa..9833139 100644 --- a/ydb_sqlalchemy/sqlalchemy/compiler/base.py +++ b/ydb_sqlalchemy/sqlalchemy/compiler/base.py @@ -228,6 +228,10 @@ def get_ydb_type( ydb_type = ydb.DecimalType(precision, scale) elif isinstance(type_, (types.ListType, sa.ARRAY)): ydb_type = ydb.ListType(self.get_ydb_type(type_.item_type, is_optional=False)) + elif isinstance(type_, sa.TupleType): + ydb_type = ydb.TupleType() + for item_type in type_.types: + ydb_type.add_element(self.get_ydb_type(item_type, is_optional=False)) elif isinstance(type_, types.StructType): ydb_type = ydb.StructType() for field, field_type in type_.fields_types.items():