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

Method test_from_list_with_columns

test/sql/test_selectable.py:1653–1664  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1651 self.assert_compile(s3, "SELECT t.c2 FROM t")
1652
1653 def test_from_list_with_columns(self):
1654 table1 = table("t1", column("a"))
1655 table2 = table("t2", column("b"))
1656 s1 = select(table1.c.a, table2.c.b)
1657 self.assert_compile(s1, "SELECT t1.a, t2.b FROM t1, t2")
1658 s2 = s1.with_only_columns(table2.c.b)
1659 self.assert_compile(s2, "SELECT t2.b FROM t2")
1660
1661 s3 = sql_util.ClauseAdapter(table1).traverse(s1)
1662 self.assert_compile(s3, "SELECT t1.a, t2.b FROM t1, t2")
1663 s4 = s3.with_only_columns(table2.c.b)
1664 self.assert_compile(s4, "SELECT t2.b FROM t2")
1665
1666 def test_from_list_against_existing_one(self):
1667 c1 = Column("c1", Integer)

Callers

nothing calls this directly

Calls 6

tableFunction · 0.90
columnFunction · 0.90
selectFunction · 0.90
assert_compileMethod · 0.80
with_only_columnsMethod · 0.80
traverseMethod · 0.45

Tested by

no test coverage detected