MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_with_expr_two

Method test_with_expr_two

test/orm/test_core_compilation.py:1594–1610  ·  view source on GitHub ↗
(self, query_expression_fixture)

Source from the content-addressed store, hash-verified

1592 )
1593
1594 def test_with_expr_two(self, query_expression_fixture):
1595 User = query_expression_fixture
1596
1597 stmt = select(User.id, User.name, (User.name + "foo").label("foo"))
1598
1599 subq = stmt.subquery()
1600 u1 = aliased(User, subq)
1601
1602 stmt = select(u1).options(with_expression(u1.value, subq.c.foo))
1603
1604 self.assert_compile(
1605 stmt,
1606 "SELECT anon_1.foo, :param_1 AS anon_2, anon_1.id, "
1607 "anon_1.name FROM "
1608 "(SELECT users.id AS id, users.name AS name, "
1609 "users.name || :name_1 AS foo FROM users) AS anon_1",
1610 )
1611
1612 def test_with_expr_three(self, query_expression_w_joinedload_fixture):
1613 """test :ticket:`6259`"""

Callers

nothing calls this directly

Calls 7

selectFunction · 0.90
aliasedFunction · 0.90
with_expressionFunction · 0.90
assert_compileMethod · 0.80
labelMethod · 0.45
subqueryMethod · 0.45
optionsMethod · 0.45

Tested by

no test coverage detected