MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_exec_multitable

Method test_exec_multitable

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

Source from the content-addressed store, hash-verified

1580
1581 @testing.requires.multi_table_update
1582 def test_exec_multitable(self, connection):
1583 users, addresses = self.tables.users, self.tables.addresses
1584
1585 values = {addresses.c.email_address: "updated", users.c.name: "ed2"}
1586
1587 connection.execute(
1588 addresses.update()
1589 .values(values)
1590 .where(users.c.id == addresses.c.user_id)
1591 .where(users.c.name == "ed")
1592 )
1593
1594 expected = [
1595 (1, 7, "x", "jack@bean.com"),
1596 (2, 8, "x", "updated"),
1597 (3, 8, "x", "updated"),
1598 (4, 8, "x", "updated"),
1599 (5, 9, "x", "fred@fred.com"),
1600 ]
1601 self._assert_addresses(connection, addresses, expected)
1602
1603 expected = [(7, "jack"), (8, "ed2"), (9, "fred"), (10, "chuck")]
1604 self._assert_users(connection, users, expected)
1605
1606 @testing.requires.multi_table_update
1607 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