MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_reduce_aliased_join

Method test_reduce_aliased_join

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

Source from the content-addressed store, hash-verified

2717 )
2718
2719 def test_reduce_aliased_join(self):
2720 metadata = MetaData()
2721 people = Table(
2722 "people",
2723 metadata,
2724 Column(
2725 "person_id",
2726 Integer,
2727 normalize_sequence(
2728 config, Sequence("person_id_seq", optional=True)
2729 ),
2730 primary_key=True,
2731 ),
2732 Column("name", String(50)),
2733 Column("type", String(30)),
2734 )
2735 engineers = Table(
2736 "engineers",
2737 metadata,
2738 Column(
2739 "person_id",
2740 Integer,
2741 ForeignKey("people.person_id"),
2742 primary_key=True,
2743 ),
2744 Column("status", String(30)),
2745 Column("engineer_name", String(50)),
2746 Column("primary_language", String(50)),
2747 )
2748 managers = Table(
2749 "managers",
2750 metadata,
2751 Column(
2752 "person_id",
2753 Integer,
2754 ForeignKey("people.person_id"),
2755 primary_key=True,
2756 ),
2757 Column("status", String(30)),
2758 Column("manager_name", String(50)),
2759 )
2760 pjoin = (
2761 people.outerjoin(engineers)
2762 .outerjoin(managers)
2763 .select()
2764 .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
2765 .alias("pjoin")
2766 )
2767 eq_(
2768 util.column_set(
2769 sql_util.reduce_columns(
2770 [
2771 pjoin.c.people_person_id,
2772 pjoin.c.engineers_person_id,
2773 pjoin.c.managers_person_id,
2774 ]
2775 )
2776 ),

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