MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_insert_from_select

Method test_insert_from_select

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

Source from the content-addressed store, hash-verified

7984 )
7985
7986 def test_insert_from_select(self):
7987 astring = Column("a", String)
7988 aint = Column("a", Integer)
7989 m = MetaData()
7990 Table("t1", m, astring)
7991 t2 = Table("t2", m, aint)
7992
7993 stmt = t2.insert().from_select(["a"], select(astring)).returning(aint)
7994 comp = stmt.compile(dialect=postgresql.dialect())
7995 eq_(
7996 comp._create_result_map(),
7997 {"a": ("a", (aint, "a", "a", "t2_a"), aint.type, 0)},
7998 )
7999
8000 def test_nested_api(self):
8001 from sqlalchemy.engine.cursor import CursorResultMetaData

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected