:ref:`tutorial_lateral_correlation` - overview of usage.
"""
- return Lateral._construct(self, name) # type: ignore
+ return Lateral._construct(self, name)
@util.deprecated(
"1.4",
"""
- return Alias._construct(self, name) # type: ignore
+ return Alias._construct(self, name)
def tablesample(
self,
:func:`_expression.tablesample` - usage guidelines and parameters
"""
- return TableSample._construct(self, sampling, name, seed) # type: ignore # noqa: E501
+ return TableSample._construct(self, sampling, name, seed)
def is_derived_from(self, fromclause: Optional[FromClause]) -> bool:
"""Return ``True`` if this :class:`_expression.FromClause` is
).self_group()
if onclause is None:
- self.onclause = self._match_primaries(self.left, self.right) # type: ignore # noqa: E501
+ self.onclause = self._match_primaries(self.left, self.right)
else:
# note: taken from If91f61527236fd4d7ae3cad1f24c38be921c90ba
# not merged yet
return name
@util.ro_non_memoized_property
- def implicit_returning(self): # type: ignore
+ def implicit_returning(self):
return self.element.implicit_returning # type: ignore
@property
("_render_derived_w_types", InternalTraversal.dp_boolean),
]
- def _init( # type: ignore
+ def _init(
self,
selectable,
name=None,
"""
- tva: TableValuedAlias = TableValuedAlias._construct( # type: ignore
+ tva: TableValuedAlias = TableValuedAlias._construct(
self,
name=name,
table_value_type=self._tableval_type,
# construct against original to prevent memory growth
# for repeated generations
- new_alias: TableValuedAlias = TableValuedAlias._construct( # type: ignore # noqa: E501
+ new_alias: TableValuedAlias = TableValuedAlias._construct(
self.element,
name=name,
table_value_type=self._tableval_type,
__visit_name__ = "tablesample"
_traverse_internals: _TraverseInternalsType = (
- AliasedReturnsRows._traverse_internals # type: ignore
+ AliasedReturnsRows._traverse_internals
+ [
("sampling", InternalTraversal.dp_clauseelement),
("seed", InternalTraversal.dp_clauseelement),
)
@util.preload_module("sqlalchemy.sql.functions")
- def _init( # type: ignore
+ def _init(
self,
selectable: Any,
sampling: Union[float, Function[Any]],
__visit_name__ = "cte"
_traverse_internals: _TraverseInternalsType = (
- AliasedReturnsRows._traverse_internals # type: ignore
+ AliasedReturnsRows._traverse_internals
+ [
("_cte_alias", InternalTraversal.dp_clauseelement),
("_restates", InternalTraversal.dp_clauseelement),
:func:`_expression.alias`
"""
- return CTE._construct( # type: ignore
+ return CTE._construct(
self.element,
name=name,
recursive=self.recursive,
self.element
), f"CTE element f{self.element} does not support union()"
- return CTE._construct( # type: ignore
+ return CTE._construct(
self.element.union(*other),
name=self.name,
recursive=self.recursive,
self.element
), f"CTE element f{self.element} does not support union_all()"
- return CTE._construct( # type: ignore
+ return CTE._construct(
self.element.union_all(*other),
name=self.name,
recursive=self.recursive,
:meth:`_expression.HasCTE.cte`.
"""
- return CTE._construct( # type: ignore
+ return CTE._construct(
self, name=name, recursive=recursive, nesting=nesting
)
) -> NamedFromGrouping:
return NamedFromGrouping(self.element.alias(name=name, flat=flat))
- def _anonymous_fromclause(self, **kw: Any): # type: ignore
+ def _anonymous_fromclause(self, **kw: Any):
return FromGrouping(self.element._anonymous_fromclause(**kw))
@util.ro_non_memoized_property
return self._implicit_subquery.columns
@property
- def columns(self): # type: ignore
+ def columns(self):
return self.c
def get_label_style(self) -> SelectLabelStyle:
if self._label_style is not LABEL_STYLE_NONE:
self = self.set_label_style(LABEL_STYLE_NONE)
- return ScalarSelect(self) # type: ignore
+ return ScalarSelect(self)
def label(self, name: Optional[str]) -> Label[Any]:
"""Return a 'scalar' representation of this selectable, embedded as a
:ref:`tutorial_lateral_correlation` - overview of usage.
"""
- return Lateral._factory(self, name) # type: ignore
+ return Lateral._factory(self, name)
def subquery(self, name: Optional[str] = None) -> Subquery:
"""Return a subquery of this :class:`_expression.SelectBase`.
"""
- return Subquery._construct(self._ensure_disambiguated_names(), name) # type: ignore # noqa: E501
+ return Subquery._construct(self._ensure_disambiguated_names(), name)
- def _ensure_disambiguated_names(self): # type: ignore
+ def _ensure_disambiguated_names(self):
"""Ensure that the names generated by this selectbase will be
disambiguated in some way, if possible.
self.element = coercions.expect(roles.SelectStatementRole, element)
def _ensure_disambiguated_names(self) -> SelectStatementGrouping:
- new_element = self.element._ensure_disambiguated_names() # type: ignore # noqa: E501
+ new_element = self.element._ensure_disambiguated_names()
if new_element is not self.element:
return SelectStatementGrouping(new_element)
else:
self, label_style: SelectLabelStyle
) -> SelectStatementGrouping:
return SelectStatementGrouping(
- self.element.set_label_style(label_style) # type: ignore
- ) # Argument 1 to "SelectStatementGrouping" has incompatible
- # type "SelectBase"; expected "Select[Any]" [arg-type]mypy(error)
+ self.element.set_label_style(label_style)
+ )
@property
def select_statement(self) -> SelectBase:
@CompileState.plugin_for("default", "compound_select")
class CompoundSelectState(CompileState):
@util.memoized_property
- def _label_resolve_dict(self): # type: ignore
+ def _label_resolve_dict(self):
# TODO: this is hacky and slow
hacky_subquery = self.statement.subquery()
hacky_subquery.named_with_column = False
def self_group(
self, against: Optional[OperatorType] = None
) -> GroupedElement:
- return SelectStatementGrouping(self) # type: ignore
+ return SelectStatementGrouping(self)
def is_derived_from(self, fromclause: Optional[FromClause]) -> bool:
for s in self.selects:
return self
def _ensure_disambiguated_names(self) -> CompoundSelect:
- new_select = self.selects[0]._ensure_disambiguated_names() # type: ignore # noqa: E501
+ new_select = self.selects[0]._ensure_disambiguated_names()
if new_select is not self.selects[0]:
self = self._generate()
self.selects = [new_select] + self.selects[1:]
return None
elif not dedupe:
- name = c._proxy_key # type: ignore
+ name = c._proxy_key
if name is None:
name = "_no_label"
return name
- name = c._tq_key_label if table_qualified else c._proxy_key # type: ignore # noqa: E501
+ name = c._tq_key_label if table_qualified else c._proxy_key
if name is None:
name = "_no_label"
if name in names:
- return c._anon_label(name) % pa # type: ignore
+ return c._anon_label(name) % pa
else:
names.add(name)
return name
elif name in names:
return (
- c._anon_tq_key_label % pa # type: ignore
+ c._anon_tq_key_label % pa
if table_qualified
- else c._anon_key_label % pa # type: ignore
+ else c._anon_key_label % pa
)
else:
names.add(name)
if froms:
toremove = set(
itertools.chain.from_iterable(
- [_expand_cloned(f._hide_froms) for f in froms] # type: ignore # noqa: E501
+ [_expand_cloned(f._hide_froms) for f in froms]
)
)
if toremove:
f
for f in froms
if f
- not in _cloned_intersection( # type: ignore
- _cloned_intersection( # type: ignore
+ not in _cloned_intersection(
+ _cloned_intersection(
froms, explicit_correlate_froms or ()
),
to_correlate,
f
for f in froms
if f
- not in _cloned_difference( # type: ignore
- _cloned_intersection( # type: ignore
+ not in _cloned_difference(
+ _cloned_intersection(
froms, explicit_correlate_froms or ()
),
self.statement._correlate_except,
f
for f in froms
if f
- not in _cloned_intersection(froms, implicit_correlate_froms) # type: ignore # noqa: E501
+ not in _cloned_intersection(froms, implicit_correlate_froms)
]
if not len(froms):
from_entity = self._filter_by_zero()
clauses = [
- _entity_namespace_key(from_entity, key) == value # type: ignore
+ _entity_namespace_key(from_entity, key) == value
for key, value in kwargs.items()
]
return self.filter(*clauses)
_MemoizedSelectEntities._generate_for_statement(self)
self._raw_columns = [
- coercions.expect(roles.ColumnsClauseRole, c) # type: ignore
- for c in coercions._expression_collection_was_a_list( # type: ignore # noqa: E501
+ coercions.expect(roles.ColumnsClauseRole, c)
+ for c in coercions._expression_collection_was_a_list(
"entities", "Select.with_only_columns", entities
)
]
self.element = element
self.type = element._scalar_type()
- def __getattr__(self, attr: str): # type: ignore
+ def __getattr__(self, attr: str):
return getattr(self.element, attr)
def __getstate__(self) -> Dict[str, Any]:
"""
e = self._clone()
e.element = self._regroup(
- lambda element: element.correlate(*fromclauses) # type: ignore
+ lambda element: element.correlate(*fromclauses)
)
return e
e = self._clone()
e.element = self._regroup(
- lambda element: element.correlate_except(*fromclauses) # type: ignore # noqa: E501
+ lambda element: element.correlate_except(*fromclauses)
)
return e
"""
e = self._clone()
- e.element = self._regroup(lambda element: element.select_from(*froms)) # type: ignore # noqa: E501
+ e.element = self._regroup(lambda element: element.select_from(*froms))
return e
def where(
"""
e = self._clone()
- e.element = self._regroup(lambda element: element.where(*clause)) # type: ignore # noqa: E501
+ e.element = self._regroup(lambda element: element.where(*clause))
return e
self.element = self.element.bindparams(*binds, **bind_as_values)
return self
- def _generate_fromclause_column_proxies( # type: ignore
+ def _generate_fromclause_column_proxies(
self,
fromclause: Subquery,
proxy_compound_columns: Optional[zip[Any]] = None,