MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_correlation_to_extra

Method test_correlation_to_extra

test/sql/test_update.py:1573–1594  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1571 )
1572
1573 def test_correlation_to_extra(self):
1574 users, addresses = self.tables.users, self.tables.addresses
1575
1576 stmt = (
1577 users.update()
1578 .values(name="newname")
1579 .where(users.c.id == addresses.c.user_id)
1580 .where(
1581 ~exists()
1582 .where(addresses.c.user_id == users.c.id)
1583 .where(addresses.c.email_address == "foo")
1584 .correlate(addresses)
1585 )
1586 )
1587
1588 self.assert_compile(
1589 stmt,
1590 "UPDATE users SET name=:name FROM addresses WHERE "
1591 "users.id = addresses.user_id AND NOT "
1592 "(EXISTS (SELECT * FROM users WHERE addresses.user_id = users.id "
1593 "AND addresses.email_address = :email_address_1))",
1594 )
1595
1596 def test_dont_correlate_to_extra(self):
1597 users, addresses = self.tables.users, self.tables.addresses

Callers

nothing calls this directly

Calls 6

existsFunction · 0.90
assert_compileMethod · 0.80
whereMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45
correlateMethod · 0.45

Tested by

no test coverage detected