MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/selectable.py:7197–7222  ·  view source on GitHub ↗
(
        self,
        __argument: Optional[
            Union[_ColumnsClauseArgument[Any], SelectBase, ScalarSelect[Any]]
        ] = None,
        /,
    )

Source from the content-addressed store, hash-verified

7195 inherit_cache = True
7196
7197 def __init__(
7198 self,
7199 __argument: Optional[
7200 Union[_ColumnsClauseArgument[Any], SelectBase, ScalarSelect[Any]]
7201 ] = None,
7202 /,
7203 ):
7204 s: ScalarSelect[Any]
7205
7206 # TODO: this seems like we should be using coercions for this
7207 if __argument is None:
7208 s = Select(literal_column("*")).scalar_subquery()
7209 elif isinstance(__argument, SelectBase):
7210 s = __argument.scalar_subquery()
7211 s._propagate_attrs = __argument._propagate_attrs
7212 elif isinstance(__argument, ScalarSelect):
7213 s = __argument
7214 else:
7215 s = Select(__argument).scalar_subquery()
7216
7217 UnaryExpression.__init__(
7218 self,
7219 s,
7220 operator=operators.exists,
7221 type_=type_api.BOOLEANTYPE,
7222 )
7223
7224 @util.ro_non_memoized_property
7225 def _from_objects(self) -> List[FromClause]:

Callers

nothing calls this directly

Calls 4

SelectClass · 0.85
literal_columnFunction · 0.85
scalar_subqueryMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected