MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_reduce_aliased_join

Method test_reduce_aliased_join

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

Source from the content-addressed store, hash-verified

2699 )
2700
2701 def test_reduce_aliased_join(self):
2702 metadata = MetaData()
2703 people = Table(
2704 "people",
2705 metadata,
2706 Column(
2707 "person_id",
2708 Integer,
2709 normalize_sequence(
2710 config, Sequence("person_id_seq", optional=True)
2711 ),
2712 primary_key=True,
2713 ),
2714 Column("name", String(50)),
2715 Column("type", String(30)),
2716 )
2717 engineers = Table(
2718 "engineers",
2719 metadata,
2720 Column(
2721 "person_id",
2722 Integer,
2723 ForeignKey("people.person_id"),
2724 primary_key=True,
2725 ),
2726 Column("status", String(30)),
2727 Column("engineer_name", String(50)),
2728 Column("primary_language", String(50)),
2729 )
2730 managers = Table(
2731 "managers",
2732 metadata,
2733 Column(
2734 "person_id",
2735 Integer,
2736 ForeignKey("people.person_id"),
2737 primary_key=True,
2738 ),
2739 Column("status", String(30)),
2740 Column("manager_name", String(50)),
2741 )
2742 pjoin = (
2743 people.outerjoin(engineers)
2744 .outerjoin(managers)
2745 .select()
2746 .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
2747 .alias("pjoin")
2748 )
2749 eq_(
2750 util.column_set(
2751 sql_util.reduce_columns(
2752 [
2753 pjoin.c.people_person_id,
2754 pjoin.c.engineers_person_id,
2755 pjoin.c.managers_person_id,
2756 ]
2757 )
2758 ),

Callers

nothing calls this directly

Calls 13

MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
normalize_sequenceFunction · 0.90
SequenceClass · 0.90
StringClass · 0.90
ForeignKeyClass · 0.90
eq_Function · 0.90
reduce_columnsMethod · 0.80
aliasMethod · 0.45
set_label_styleMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected