Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions ydb_sqlalchemy/sqlalchemy/compiler/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down