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

Method _anonymous_fromclause

lib/sqlalchemy/sql/selectable.py:1614–1653  ·  view source on GitHub ↗
(
        self, name: Optional[str] = None, flat: bool = False
    )

Source from the content-addressed store, hash-verified

1612
1613 @util.preload_module("sqlalchemy.sql.util")
1614 def _anonymous_fromclause(
1615 self, name: Optional[str] = None, flat: bool = False
1616 ) -> TODO_Any:
1617 sqlutil = util.preloaded.sql_util
1618 if flat:
1619 if isinstance(self.left, (FromGrouping, Join)):
1620 left_name = name # will recurse
1621 else:
1622 if name and isinstance(self.left, NamedFromClause):
1623 left_name = f"{name}_{self.left.name}"
1624 else:
1625 left_name = name
1626 if isinstance(self.right, (FromGrouping, Join)):
1627 right_name = name # will recurse
1628 else:
1629 if name and isinstance(self.right, NamedFromClause):
1630 right_name = f"{name}_{self.right.name}"
1631 else:
1632 right_name = name
1633 left_a, right_a = (
1634 self.left._anonymous_fromclause(name=left_name, flat=flat),
1635 self.right._anonymous_fromclause(name=right_name, flat=flat),
1636 )
1637 adapter = sqlutil.ClauseAdapter(left_a).chain(
1638 sqlutil.ClauseAdapter(right_a)
1639 )
1640
1641 return left_a.join(
1642 right_a,
1643 adapter.traverse(self.onclause),
1644 isouter=self.isouter,
1645 full=self.full,
1646 )
1647 else:
1648 return (
1649 self.select()
1650 .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
1651 .correlate(None)
1652 .alias(name)
1653 )
1654
1655 @util.ro_non_memoized_property
1656 def _hide_froms(self) -> Iterable[FromClause]:

Callers 15

_anonymous_fromclauseMethod · 0.45
_post_coercionMethod · 0.45
_criterion_existsMethod · 0.45
_optimized_compareMethod · 0.45
_create_joinsMethod · 0.45
join_targetsMethod · 0.45
__init__Method · 0.45
_merge_withMethod · 0.45
_generate_row_adapterMethod · 0.45
_legacy_from_selfMethod · 0.45

Calls 7

selectMethod · 0.95
chainMethod · 0.45
joinMethod · 0.45
traverseMethod · 0.45
aliasMethod · 0.45
correlateMethod · 0.45
set_label_styleMethod · 0.45