MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_insert_with_select_values

Method test_insert_with_select_values

test/sql/test_compiler.py:7968–7984  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7966 is_(comp._create_result_map()["t1_a"][1][2], t1.c.a)
7967
7968 def test_insert_with_select_values(self):
7969 astring = Column("a", String)
7970 aint = Column("a", Integer)
7971 m = MetaData()
7972 Table("t1", m, astring)
7973 t2 = Table("t2", m, aint)
7974
7975 stmt = (
7976 t2.insert()
7977 .values(a=select(astring).scalar_subquery())
7978 .returning(aint)
7979 )
7980 comp = stmt.compile(dialect=postgresql.dialect())
7981 eq_(
7982 comp._create_result_map(),
7983 {"a": ("a", (aint, "a", "a", "t2_a"), aint.type, 0)},
7984 )
7985
7986 def test_insert_from_select(self):
7987 astring = Column("a", String)

Callers

nothing calls this directly

Calls 12

ColumnClass · 0.90
MetaDataClass · 0.90
TableClass · 0.90
selectFunction · 0.90
eq_Function · 0.90
_create_result_mapMethod · 0.80
returningMethod · 0.45
valuesMethod · 0.45
insertMethod · 0.45
scalar_subqueryMethod · 0.45
compileMethod · 0.45
dialectMethod · 0.45

Tested by

no test coverage detected