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

Method test_inline_defaults

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

Source from the content-addressed store, hash-verified

455 )
456
457 def test_inline_defaults(self):
458 m = MetaData()
459 foo = Table("foo", m, Column("id", Integer))
460
461 t = Table(
462 "test",
463 m,
464 Column("col1", Integer, onupdate=func.foo(1)),
465 Column(
466 "col2",
467 Integer,
468 onupdate=select(func.coalesce(func.max(foo.c.id))),
469 ),
470 Column("col3", String(30)),
471 )
472
473 self.assert_compile(
474 t.update().values({"col3": "foo"}),
475 "UPDATE test SET col1=foo(:foo_1), col2=(SELECT "
476 "coalesce(max(foo.id)) AS coalesce_1 FROM foo), "
477 "col3=:col3",
478 )
479
480 self.assert_compile(
481 t.update().inline().values({"col3": "foo"}),
482 "UPDATE test SET col1=foo(:foo_1), col2=(SELECT "
483 "coalesce(max(foo.id)) AS coalesce_1 FROM foo), "
484 "col3=:col3",
485 )
486
487 def test_update_1(self):
488 table1 = self.tables.mytable

Callers

nothing calls this directly

Calls 12

MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
selectFunction · 0.90
StringClass · 0.90
coalesceMethod · 0.80
maxMethod · 0.80
assert_compileMethod · 0.80
fooMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45
inlineMethod · 0.45

Tested by

no test coverage detected