Skip to content

SQLAlchemy improvements for generative methods #7603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/ext/asyncio/engine.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from typing import Any

from .base import ProxyComparable, StartableContext

def create_async_engine(*arg, **kw): ...
def create_async_engine(*arg, **kw) -> AsyncEngine: ...

class AsyncConnectable: ...

Expand Down
57 changes: 29 additions & 28 deletions stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Self
from typing import Any

from .. import util
Expand Down Expand Up @@ -37,14 +38,14 @@ class Selectable(ReturnsRows):
def corresponding_column(self, column, require_embedded: bool = ...): ...

class HasPrefixes:
def prefix_with(self, *expr, **kw) -> None: ...
def prefix_with(self: Self, *expr, **kw) -> Self: ...

class HasSuffixes:
def suffix_with(self, *expr, **kw) -> None: ...
def suffix_with(self: Self, *expr, **kw) -> Self: ...

class HasHints:
def with_statement_hint(self, text, dialect_name: str = ...): ...
def with_hint(self, selectable, text, dialect_name: str = ...) -> None: ...
def with_hint(self: Self, selectable, text: str, dialect_name: str = ...) -> Self: ...

class FromClause(roles.AnonymizedFromClauseRole, Selectable):
__visit_name__: str
Expand Down Expand Up @@ -190,9 +191,9 @@ class Values(Generative, FromClause):
name: Any
literal_binds: Any
def __init__(self, *columns, **kw) -> None: ...
def alias(self, name, **kw) -> None: ... # type: ignore[override]
def lateral(self, name: Any | None = ...) -> None: ...
def data(self, values) -> None: ...
def alias(self: Self, name: Any | None, **kw) -> Self: ... # type: ignore[override]
def lateral(self: Self, name: Any | None = ...) -> Self: ...
def data(self: Self, values) -> Self: ...

class SelectBase(
roles.SelectStatementRole,
Expand Down Expand Up @@ -250,17 +251,17 @@ class GenerativeSelect(DeprecatedSelectBaseGenerations, SelectBase):
bind: Any | None = ...,
) -> None: ...
def with_for_update(
self, nowait: bool = ..., read: bool = ..., of: Any | None = ..., skip_locked: bool = ..., key_share: bool = ...
) -> None: ...
self: Self, nowait: bool = ..., read: bool = ..., of: Any | None = ..., skip_locked: bool = ..., key_share: bool = ...
) -> Self: ...
def get_label_style(self): ...
def set_label_style(self, style): ...
def apply_labels(self): ...
def limit(self, limit) -> None: ...
def fetch(self, count, with_ties: bool = ..., percent: bool = ...) -> None: ...
def offset(self, offset) -> None: ...
def slice(self, start, stop) -> None: ...
def order_by(self, *clauses) -> None: ...
def group_by(self, *clauses) -> None: ...
def limit(self: Self, limit: Any | None) -> Self: ...
def fetch(self: Self, count: Any | None, with_ties: bool = ..., percent: bool = ...) -> Self: ...
def offset(self: Self, offset: Any | None) -> Self: ...
def slice(self: Self, start: Any | None, stop: Any | None) -> Self: ...
def order_by(self: Self, *clauses) -> Self: ...
def group_by(self: Self, *clauses) -> Self: ...

class CompoundSelectState(CompileState): ...

Expand Down Expand Up @@ -338,9 +339,9 @@ class Select(
@property
def column_descriptions(self): ...
def from_statement(self, statement): ...
def join(self, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> None: ...
def join(self: Self, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ...
def outerjoin_from(self, from_, target, onclause: Any | None = ..., full: bool = ...): ...
def join_from(self, from_, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> None: ...
def join_from(self: Self, from_, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ...
def outerjoin(self, target, onclause: Any | None = ..., full: bool = ...): ...
def get_final_froms(self): ...
@property
Expand All @@ -351,18 +352,18 @@ class Select(
def inner_columns(self): ...
def is_derived_from(self, fromclause): ...
def get_children(self, **kwargs): ...
def add_columns(self, *columns) -> None: ...
def add_columns(self: Self, *columns) -> Self: ...
def column(self, column): ...
def reduce_columns(self, only_synonyms: bool = ...): ...
def with_only_columns(self, *columns, **kw) -> None: ...
def with_only_columns(self: Self, *columns, **kw) -> Self: ...
@property
def whereclause(self): ...
def where(self, *whereclause) -> None: ...
def having(self, having) -> None: ...
def distinct(self, *expr) -> None: ...
def select_from(self, *froms) -> None: ...
def correlate(self, *fromclauses) -> None: ...
def correlate_except(self, *fromclauses) -> None: ...
def where(self: Self, *whereclause) -> Self: ...
def having(self: Self, having) -> Self: ...
def distinct(self: Self, *expr) -> Self: ...
def select_from(self: Self, *froms) -> Self: ...
def correlate(self: Self, *fromclauses) -> Self: ...
def correlate_except(self: Self, *fromclauses) -> Self: ...
@HasMemoized.memoized_attribute
def selected_columns(self): ...
def self_group(self, against: Any | None = ...): ...
Expand All @@ -386,10 +387,10 @@ class ScalarSelect(roles.InElementRole, Generative, Grouping):
def columns(self) -> None: ...
@property
def c(self): ...
def where(self, crit) -> None: ...
def where(self: Self, crit) -> Self: ...
def self_group(self, **kwargs): ...
def correlate(self, *fromclauses) -> None: ...
def correlate_except(self, *fromclauses) -> None: ...
def correlate(self: Self, *fromclauses) -> Self: ...
def correlate_except(self: Self, *fromclauses) -> Self: ...

class Exists(UnaryExpression):
inherit_cache: bool
Expand All @@ -410,7 +411,7 @@ class TextualSelect(SelectBase):
def __init__(self, text, columns, positional: bool = ...) -> None: ...
@HasMemoized.memoized_attribute
def selected_columns(self): ...
def bindparams(self, *binds, **bind_as_values) -> None: ...
def bindparams(self: Self, *binds, **bind_as_values) -> Self: ...

TextAsFrom = TextualSelect

Expand Down