MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_correlated_update_three

Method test_correlated_update_three

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

Source from the content-addressed store, hash-verified

292 )
293
294 def test_correlated_update_three(self):
295 table1 = self.tables.mytable
296 table2 = self.tables.myothertable
297
298 # test against a regular constructed subquery
299 s = (
300 select(table2)
301 .where(table2.c.otherid == table1.c.myid)
302 .scalar_subquery()
303 )
304 u = (
305 update(table1)
306 .where(table1.c.name == "jack")
307 .values({table1.c.name: s})
308 )
309 self.assert_compile(
310 u,
311 "UPDATE mytable SET name=(SELECT myothertable.otherid, "
312 "myothertable.othername FROM myothertable WHERE "
313 "myothertable.otherid = mytable.myid) "
314 "WHERE mytable.name = :name_1",
315 )
316
317 def test_correlated_update_four(self):
318 table1 = self.tables.mytable

Callers

nothing calls this directly

Calls 6

selectFunction · 0.90
updateFunction · 0.90
assert_compileMethod · 0.80
scalar_subqueryMethod · 0.45
whereMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected