MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_correlated_update_five

Method test_correlated_update_five

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

Source from the content-addressed store, hash-verified

330 )
331
332 def test_correlated_update_five(self):
333 table1 = self.tables.mytable
334 table2 = self.tables.myothertable
335
336 # test one that is actually correlated...
337 s = select(table2.c.othername).where(table2.c.otherid == table1.c.myid)
338 u = table1.update().where(table1.c.name == s.scalar_subquery())
339 self.assert_compile(
340 u,
341 "UPDATE mytable SET myid=:myid, name=:name, "
342 "description=:description WHERE mytable.name = "
343 "(SELECT myothertable.othername FROM myothertable "
344 "WHERE myothertable.otherid = mytable.myid)",
345 )
346
347 def test_correlated_update_six(self):
348 table1 = self.tables.mytable

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
assert_compileMethod · 0.80
whereMethod · 0.45
updateMethod · 0.45
scalar_subqueryMethod · 0.45

Tested by

no test coverage detected