MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_expanding_in_composite

Method test_expanding_in_composite

test/sql/test_query.py:723–755  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

721
722 @testing.requires.tuple_in
723 def test_expanding_in_composite(self, connection):
724 users = self.tables.users
725
726 connection.execute(
727 users.insert(),
728 [
729 dict(user_id=7, user_name="jack"),
730 dict(user_id=8, user_name="fred"),
731 dict(user_id=9, user_name=None),
732 ],
733 )
734
735 stmt = (
736 select(users)
737 .where(
738 tuple_(users.c.user_id, users.c.user_name).in_(
739 bindparam("uname", expanding=True)
740 )
741 )
742 .order_by(users.c.user_id)
743 )
744
745 eq_(
746 connection.execute(stmt, {"uname": [(7, "jack")]}).fetchall(),
747 [(7, "jack")],
748 )
749
750 eq_(
751 connection.execute(
752 stmt, {"uname": [(7, "jack"), (8, "fred")]}
753 ).fetchall(),
754 [(7, "jack"), (8, "fred")],
755 )
756
757 @testing.skip_if(["mssql"])
758 def test_bind_in(self, connection):

Callers

nothing calls this directly

Calls 10

selectFunction · 0.90
tuple_Function · 0.90
bindparamFunction · 0.90
eq_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
order_byMethod · 0.45
whereMethod · 0.45
in_Method · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected