MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_exec_multitable

Method test_exec_multitable

test/sql/test_update.py:1712–1734  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

1710
1711 @testing.requires.multi_table_update
1712 def test_exec_multitable(self, connection):
1713 users, addresses = self.tables.users, self.tables.addresses
1714
1715 values = {addresses.c.email_address: "updated", users.c.name: "ed2"}
1716
1717 connection.execute(
1718 addresses.update()
1719 .values(values)
1720 .where(users.c.id == addresses.c.user_id)
1721 .where(users.c.name == "ed")
1722 )
1723
1724 expected = [
1725 (1, 7, "x", "jack@bean.com"),
1726 (2, 8, "x", "updated"),
1727 (3, 8, "x", "updated"),
1728 (4, 8, "x", "updated"),
1729 (5, 9, "x", "fred@fred.com"),
1730 ]
1731 self._assert_addresses(connection, addresses, expected)
1732
1733 expected = [(7, "jack"), (8, "ed2"), (9, "fred"), (10, "chuck")]
1734 self._assert_users(connection, users, expected)
1735
1736 @testing.requires.multi_table_update
1737 def test_exec_join_multitable(self, connection):

Callers

nothing calls this directly

Calls 6

_assert_addressesMethod · 0.95
_assert_usersMethod · 0.95
executeMethod · 0.45
whereMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected