MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_update_custom_key_thing

Method test_update_custom_key_thing

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

Source from the content-addressed store, hash-verified

191 )
192
193 def test_update_custom_key_thing(self):
194 table1 = self.tables.mytable
195
196 class Thing:
197 def __clause_element__(self):
198 return table1.c.name
199
200 stmt = (
201 table1.update()
202 .values({Thing(): "jack"})
203 .where(table1.c.name == "jill")
204 )
205
206 self.assert_compile(
207 stmt,
208 "UPDATE mytable SET name='jack' WHERE mytable.name = 'jill'",
209 literal_binds=True,
210 )
211
212 def test_update_ordered_custom_key_thing(self):
213 table1 = self.tables.mytable

Callers

nothing calls this directly

Calls 5

assert_compileMethod · 0.80
ThingClass · 0.70
whereMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected