MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_label_conflict_union

Method test_label_conflict_union

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

Source from the content-addressed store, hash-verified

7946 )
7947
7948 def test_label_conflict_union(self):
7949 t1 = Table(
7950 "t1", MetaData(), Column("a", Integer), Column("b", Integer)
7951 )
7952 t2 = Table("t2", MetaData(), Column("t1_a", Integer))
7953 union = select(t2).union(select(t2)).alias()
7954
7955 t1_alias = t1.alias()
7956 stmt = (
7957 select(t1, t1_alias)
7958 .select_from(t1.join(union, t1.c.a == union.c.t1_a))
7959 .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
7960 )
7961 comp = stmt.compile()
7962 eq_(
7963 set(comp._create_result_map()),
7964 {"t1_1_b", "t1_1_a", "t1_a", "t1_b"},
7965 )
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)

Callers

nothing calls this directly

Calls 13

TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90
selectFunction · 0.90
eq_Function · 0.90
is_Function · 0.90
_create_result_mapMethod · 0.80
aliasMethod · 0.45
unionMethod · 0.45
set_label_styleMethod · 0.45
select_fromMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected