MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_inline_defaults

Method test_inline_defaults

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

Source from the content-addressed store, hash-verified

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