diff --git a/sqlalchemy-stubs/sql/elements.pyi b/sqlalchemy-stubs/sql/elements.pyi index 5fd8de6..ff51f47 100644 --- a/sqlalchemy-stubs/sql/elements.pyi +++ b/sqlalchemy-stubs/sql/elements.pyi @@ -13,6 +13,7 @@ from .type_api import TypeEngine from .sqltypes import NullType, Boolean, Integer from .selectable import TextAsFrom, TableClause from .functions import FunctionElement +from .schema import ForeignKey _T = TypeVar('_T') _T_contra = TypeVar('_T_contra', contravariant=True) @@ -44,27 +45,32 @@ class ClauseElement(Visitable): def __bool__(self): ... __nonzero__: Any = ... +_CE = TypeVar('_CE', bound=ColumnElement) + class ColumnElement(operators.ColumnOperators, ClauseElement, Generic[_T]): __visit_name__: str = ... - primary_key: Any = ... - foreign_keys: List[Any] = ... - key: Any = ... - def self_group(self, against: Optional[Any] = ...): ... + primary_key: bool = ... + foreign_keys: List[ForeignKey] = ... + key: Optional[str] = ... + def self_group(self: _CE, against: Optional[Any] = ...) -> Union[AsBoolean, Grouping[_T], _CE]: ... @property def type(self) -> TypeEngine[_T]: ... def comparator(self): ... - def __getattr__(self, key): ... + def __getattr__(self, key: str) -> Any: ... def operate(self, op, *other, **kwargs): ... def reverse_operate(self, op, other, **kwargs): ... @property - def expression(self): ... - def base_columns(self): ... - def proxy_set(self): ... - def shares_lineage(self, othercolumn): ... - def compare(self, other: Any, **kw: Any) -> bool: ... - def cast(self, type_): ... - def label(self, name): ... - def anon_label(self): ... + def expression(self: _CE) -> _CE: ... + def base_columns(self) -> Set[ColumnElement[Any]]: ... + def proxy_set(self) -> Set[ColumnElement[Any]]: ... + def shares_lineage(self, othercolumn: ColumnElement[Any]) -> bool: ... + def compare(self, other: ColumnElement[Any], use_proxies: bool = ..., equivalents: bool = ..., **kw: Any) -> bool: ... + @overload + def cast(self, type_: Type[TypeEngine[_U]]) -> Cast[_U]: ... + @overload + def cast(self, type_: TypeEngine[_U]) -> Cast[_U]: ... + def label(self, name: str) -> Label[_T]: ... + def anon_label(self) -> _anonymous_label: ... class BindParameter(ColumnElement[_T]): __visit_name__: str = ... @@ -87,7 +93,8 @@ class BindParameter(ColumnElement[_T]): _compared_to_type: Optional[Any] = ...) -> None: ... @property def effective_value(self) -> _T: ... - def compare(self, other: Any, **kw: Any) -> bool: ... + # Signature of "compare" incompatible with supertype "ColumnElement" + def compare(self, other: ColumnElement[Any], **kw: Any) -> bool: ... # type: ignore class TypeClause(ClauseElement, Generic[_T]): __visit_name__: str = ... @@ -168,19 +175,21 @@ class ClauseList(ClauseElement): _BCL = TypeVar('_BCL', bound=BooleanClauseList) -class BooleanClauseList(ClauseList, ColumnElement[bool]): +# Definitions of "compare" and "self_group" in ClauseList are incompatible with ColumnElement +class BooleanClauseList(ClauseList, ColumnElement[bool]): # type: ignore __visit_name__: str = ... # Note: passing strings to below generates a warning, but still works. @classmethod def and_(cls, *clauses: Union[ClauseElement, str, bool]) -> BooleanClauseList: ... @classmethod def or_(cls, *clauses: Union[ClauseElement, str, bool]) -> BooleanClauseList: ... - def self_group(self: _BCL, against: Optional[Any] = ...) -> Union[_BCL, Grouping[Any]]: ... + def self_group(self: _BCL, against: Optional[Any] = ...) -> Union[_BCL, Grouping[bool]]: ... and_ = BooleanClauseList.and_ or_ = BooleanClauseList.or_ -class Tuple(ClauseList, ColumnElement[_T]): +# Definitions of "compare" and "self_group" in ClauseList are incompatible with ColumnElement +class Tuple(ClauseList, ColumnElement[_T]): # type: ignore type: TypeEngine[_T] = ... @overload def __init__(self, *clauses: ColumnElement[Any], type_: Type[TypeEngine[_T]], **kw: Any) -> None: ... @@ -261,7 +270,8 @@ class UnaryExpression(ColumnElement[_T]): type_: Optional[TypeEngine[_T]] = ..., negate: Optional[Any] = ..., wraps_column_expression: bool = ...) -> None: ... def get_children(self, **kwargs) -> _TupleType[Any]: ... - def compare(self, other: Any, **kw: Any) -> bool: ... + # Signature of "compare" incompatible with supertype "ColumnElement" + def compare(self, other: ColumnElement[Any], **kw: Any) -> bool: ... # type: ignore def self_group(self: _UE, against: Optional[Any] = ...) -> Union[_UE, Grouping[_T]]: ... @classmethod def _create_nullsfirst(cls, column: ColumnElement[Any]) -> UnaryExpression[NullType]: ... @@ -292,14 +302,14 @@ class CollectionAggregate(UnaryExpression[_T]): _AB = TypeVar('_AB', bound=AsBoolean) -class AsBoolean(UnaryExpression): - element: Any = ... +class AsBoolean(UnaryExpression[bool]): + element: ColumnElement[Any] = ... type: Boolean = ... operator: Callable[..., Any] = ... - negate: Any = ... + negate: Callable[..., Any] = ... modifier: Any = ... wraps_column_expression: bool = ... - def __init__(self, element: Any, operator: Callable[..., Any], negate: Any) -> None: ... + def __init__(self, element: ColumnElement[Any], operator: Callable[..., Any], negate: Callable[..., Any]) -> None: ... def self_group(self: _AB, against: Optional[Any] = ...) -> _AB: ... _BE = TypeVar('_BE', bound=BinaryExpression) @@ -324,7 +334,8 @@ class BinaryExpression(ColumnElement[_T], Generic[_T, _U, _V]): @property def is_comparison(self): ... def get_children(self, **kwargs): ... - def compare(self, other: Any, **kw: Any) -> bool: ... + # Signature of "compare" incompatible with supertype "ColumnElement" + def compare(self, other: ColumnElement[Any], **kw: Any) -> bool: ... # type: ignore def self_group(self: _BE, against: Optional[Any] = ...) -> Union[_BE, Grouping[_T]]: ... _SL = TypeVar('_SL', bound=Slice) @@ -336,7 +347,7 @@ class Slice(ColumnElement[None]): step: Any = ... type: NullType = ... def __init__(self, start, stop, step) -> None: ... - def self_group(self: _SL, against: Optional[Any] = ...) -> Union[_SL, Grouping[NullType]]: ... + def self_group(self: _SL, against: Optional[Any] = ...) -> _SL: ... class IndexExpression(BinaryExpression): ... @@ -354,7 +365,8 @@ class Grouping(ColumnElement[_T]): def self_group(self: _G, against: Optional[Any] = ...) -> _G: ... def get_children(self, **kwargs) -> _TupleType[ClauseElement]: ... def __getattr__(self, attr): ... - def compare(self, other: Any, **kw: Any) -> bool: ... + # Signature of "compare" incompatible with supertype "ColumnElement" + def compare(self, other: ColumnElement[Any], **kw: Any) -> bool: ... # type: ignore RANGE_UNBOUNDED: util.symbol = ... RANGE_CURRENT: util.symbol = ... @@ -432,11 +444,13 @@ class Label(ColumnElement[_T]): def type(self) -> TypeEngine[_T]: ... @property def element(self) -> ColumnElement[_T]: ... - def self_group(self, against: Optional[Any] = ...) -> Union[ColumnElement[_T], Grouping[_T]]: ... + def self_group(self: _L, against: Optional[Any] = ...) -> Union[_L, Label[_T]]: ... + # Signature of "primary_key" incompatible with supertype "ColumnElement" @property - def primary_key(self) -> Any: ... + def primary_key(self) -> bool: ... # type: ignore + # Signature of "foreign_keys" incompatible with supertype "ColumnElement" @property - def foreign_keys(self) -> List[Any]: ... # type: ignore + def foreign_keys(self) -> List[ForeignKey]: ... # type: ignore def get_children(self, **kwargs: Any) -> Any: ... class ColumnClause(Immutable, ColumnElement[_T]): @@ -485,6 +499,8 @@ class _truncated_label(quoted_name): class conv(_truncated_label): ... +class _anonymous_label(_truncated_label): ... + class AnnotatedColumnElement(Annotated, Generic[_T]): def __init__(self, element: ColumnElement[_T], values: Any) -> None: ... @property diff --git a/sqlalchemy-stubs/sql/functions.pyi b/sqlalchemy-stubs/sql/functions.pyi index 35350d7..5cd591b 100644 --- a/sqlalchemy-stubs/sql/functions.pyi +++ b/sqlalchemy-stubs/sql/functions.pyi @@ -1,6 +1,8 @@ from typing import Any, Optional, Union, Iterable, Tuple, TypeVar, Generic, overload from .base import Executable as Executable, ColumnCollection -from .elements import ColumnElement as ColumnElement, Grouping, ClauseList, ColumnElement, Over, WithinGroup, FunctionFilter +from .elements import ( + ColumnElement as ColumnElement, Grouping, ClauseList, ColumnElement, Over, WithinGroup, FunctionFilter, AsBoolean +) from .selectable import FromClause as FromClause, Alias, Select from . import util as sqlutil from .visitors import VisitableType as VisitableType @@ -13,6 +15,8 @@ _T = TypeVar('_T') def register_function(identifier, fn, package: str = ...): ... +_FE = TypeVar('_FE', bound=FunctionElement) + class FunctionElement(Executable, ColumnElement[_T], FromClause, Generic[_T]): # type: ignore # ColumnElement.foreign_keys() is not compatible with FromClause.foreign_keys() packagenames: Any = ... @@ -35,7 +39,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generic[_T]): ColumnElement[Any], Iterable[Union[str, ColumnElement[Any]]]]) -> WithinGroup[_T]: ... @overload - def filter(self) -> FunctionElement[_T]: ... + def filter(self: _FE) -> _FE: ... @overload def filter(self, criteria: Any, *criterion: Any) -> FunctionFilter[_T]: ... def get_children(self, **kwargs: Any) -> Tuple[Grouping[Any]]: ... @@ -44,7 +48,7 @@ class FunctionElement(Executable, ColumnElement[_T], FromClause, Generic[_T]): def select(self) -> Select: ... # type: ignore # incompatible with FromClause.select def scalar(self) -> Any: ... # type: ignore # incompatible with Executable.scalar def execute(self) -> ResultProxy: ... # type: ignore # incompatible with Executable.execute - def self_group(self, against: Optional[Any] = ...) -> Union[ColumnElement[_T], Grouping[_T]]: ... + def self_group(self: _FE, against: Optional[Any] = ...) -> Union[AsBoolean, Grouping[_T], _FE]: ... class _FunctionGenerator(object): opts: Any = ... diff --git a/sqlalchemy-stubs/sql/schema.pyi b/sqlalchemy-stubs/sql/schema.pyi index 2d330c0..da8b2c2 100644 --- a/sqlalchemy-stubs/sql/schema.pyi +++ b/sqlalchemy-stubs/sql/schema.pyi @@ -1,88 +1,118 @@ -from typing import Any, Optional, Set, Generic, TypeVar, Type, Iterable, overload -from . import visitors +from typing import ( + Any, Optional, Union, Set, Generic, TypeVar, Type, List, Dict, Tuple, Set, Sequence as SequenceType, Mapping, + Callable, Iterable, Iterator, overload +) +from . import visitors, functions from .base import SchemaEventTarget as SchemaEventTarget, DialectKWArgs as DialectKWArgs, ColumnCollection from .elements import ColumnClause as ColumnClause from .selectable import TableClause as TableClause from .type_api import TypeEngine +from .. import util +from ..engine import Engine, Connection, Connectable +from .compiler import DDLCompiler +import threading _T = TypeVar('_T') -RETAIN_SCHEMA: Any = ... -BLANK_SCHEMA: Any = ... +RETAIN_SCHEMA: util.symbol = ... +BLANK_SCHEMA: util.symbol = ... class SchemaItem(SchemaEventTarget, visitors.Visitable): __visit_name__: str = ... def get_children(self, **kwargs: Any) -> Iterable[Any]: ... @property - def quote(self): ... + def quote(self) -> str: ... @property - def info(self): ... + def info(self) -> Optional[Mapping[str, Any]]: ... # Definition of "get_children" in base class "SchemaItem" is incompatible with definition in base class "TableClause" class Table(DialectKWArgs, SchemaItem, TableClause): # type: ignore __visit_name__: str - metadata: Any - schema: Any - indexes: Set[Any] - constraints: Set[Any] - foreign_keys: Set[Any] + metadata: MetaData + schema: Optional[str] + indexes: Set[Index] + constraints: Set[Constraint] + foreign_keys: Set[ForeignKey] primary_key: PrimaryKeyConstraint # type: ignore # TableClause.primary_key defines this as "ColumnSet" fullname: str implicit_returning: bool comment: Any def __new__(cls, *args, **kw): ... @property - def quote_schema(self): ... - def __init__(self, *args, **kw) -> None: ... + def quote_schema(self) -> Optional[bool]: ... + def __init__(self, name: str, metadata: MetaData, *args: Any, autoload: bool = ..., autoload_replace: bool = ..., + autoload_with: Union[Engine, Connection] = ..., extend_existing: bool = ..., implicit_returning: bool = ..., + include_columns: SequenceType[str] = ..., info: Mapping[str, Any] = ..., keep_existing: bool = ..., + listeners: SequenceType[Tuple[str, Callable[..., Any]]] = ..., mustexist: bool = ..., + prefixes: SequenceType[str] = ..., quote: Optional[bool] = ..., quote_schema: Optional[bool] = ..., + schema: Optional[str] = ..., comment: str = ..., **kw: Any) -> None: ... @property def foreign_key_constraints(self) -> Set[ForeignKeyConstraint]: ... @property - def key(self): ... + def key(self) -> str: ... @property - def bind(self): ... - def add_is_dependent_on(self, table): ... - def append_column(self, column): ... - def append_constraint(self, constraint): ... - def append_ddl_listener(self, event_name, listener): ... - def get_children(self, column_collections: bool = ..., schema_visitor: bool = ..., **kwargs): ... - def exists(self, bind: Optional[Any] = ...): ... - def create(self, bind: Optional[Any] = ..., checkfirst: bool = ...): ... - def drop(self, bind: Optional[Any] = ..., checkfirst: bool = ...): ... - def tometadata(self, metadata, schema: Any = ..., referred_schema_fn: Optional[Any] = ..., - name: Optional[Any] = ...): ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... + def add_is_dependent_on(self, table: Table) -> None: ... + def append_column(self, column: ColumnClause[Any]) -> None: ... + def append_constraint(self, constraint: Constraint) -> None: ... + def append_ddl_listener(self, event_name: str, listener: Callable[..., Any]) -> None: ... + def get_children(self, column_collections: bool = ..., schema_visitor: bool = ..., **kw: Any) -> List[Any]: ... + def exists(self, bind: Optional[Union[Engine, Connection]] = ...) -> bool: ... + def create(self, bind: Optional[Connectable] = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Optional[Connectable] = ..., checkfirst: bool = ...) -> None: ... + def tometadata(self, metadata: MetaData, schema: str = ..., + referred_schema_fn: Optional[Callable[[Table, str, ForeignKeyConstraint, str], str]] = ..., + name: Optional[str] = ...) -> Table: ... + +_C = TypeVar('_C', bound=Column) class Column(SchemaItem, ColumnClause[_T]): __visit_name__: str = ... - key: Any = ... - primary_key: Any = ... + key: str = ... + primary_key: bool = ... nullable: bool = ... - default: Any = ... - server_default: Any = ... - server_onupdate: Any = ... - index: Any = ... - unique: Any = ... - system: Any = ... - doc: Any = ... - onupdate: Any = ... - autoincrement: Any = ... - constraints: Any = ... - foreign_keys: Any = ... - info: Any = ... + default: Optional[Any] = ... + server_default: Optional[Any] = ... + server_onupdate: Optional[FetchedValue] = ... + index: Optional[bool] = ... + unique: Optional[bool] = ... + system: bool = ... + doc: Optional[str] = ... + onupdate: Optional[Any] = ... + autoincrement: Union[bool, str] = ... + constraints: Set[Constraint] = ... + foreign_keys: Set[ForeignKey] = ... # type: ignore # incompatible with ColumnElement.foreign_keys + info: Optional[Mapping[str, Any]] = ... + comment: Optional[str] = ... table: Table = ... # TODO: double-check this. @overload - def __init__(self, name: str, type_: Type[TypeEngine[_T]], *args, **kwargs) -> None: ... - @overload - def __init__(self, type_: Type[TypeEngine[_T]], *args, **kwargs) -> None: ... + def __init__(self, name: str, type_: Type[TypeEngine[_T]], *args: Any, autoincrement: Union[bool, str] = ..., + default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., + nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., + server_onupdate: FetchedValue = ..., quote: Optional[bool] = ..., unique: bool = ..., + system: bool = ..., comment: str = ...) -> None: ... @overload - def __init__(self, name: str, type_: TypeEngine[_T], *args, **kwargs) -> None: ... + def __init__(self, type_: Type[TypeEngine[_T]], *args: Any, autoincrement: Union[bool, str] = ..., + default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., + nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., + server_onupdate: FetchedValue = ..., quote: Optional[bool] = ..., unique: bool = ..., + system: bool = ..., comment: str = ...) -> None: ... @overload - def __init__(self, type_: TypeEngine[_T], *args, **kwargs) -> None: ... + def __init__(self, name: str, type_: TypeEngine[_T], *args: Any, autoincrement: Union[bool, str] = ..., + default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., + nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., + server_onupdate: FetchedValue = ..., quote: Optional[bool] = ..., unique: bool = ..., + system: bool = ..., comment: str = ...) -> None: ... @overload - def __init__(self, *args, **kwargs) -> None: ... - def references(self, column): ... - def append_foreign_key(self, fk): ... - def copy(self, **kw): ... - def get_children(self, schema_visitor: bool = ..., **kwargs): ... + def __init__(self, type_: TypeEngine[_T], *args: Any, autoincrement: Union[bool, str] = ..., + default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., + nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., + server_onupdate: FetchedValue = ..., quote: Optional[bool] = ..., unique: bool = ..., + system: bool = ..., comment: str = ...) -> None: ... + def references(self, column: Column[Any]) -> bool: ... + def append_foreign_key(self, fk: ForeignKey) -> None: ... + def copy(self: _C, **kw: Any) -> _C: ... + def get_children(self, schema_visitor: bool = ..., **kwargs) -> List[Any]: ... @overload def __get__(self, instance: None, owner: Any) -> Column[_T]: ... @overload @@ -90,27 +120,27 @@ class Column(SchemaItem, ColumnClause[_T]): class ForeignKey(DialectKWArgs, SchemaItem): __visit_name__: str = ... - constraint: Any = ... - parent: Any = ... - use_alter: Any = ... - name: Any = ... - onupdate: Any = ... - ondelete: Any = ... - deferrable: Any = ... - initially: Any = ... - link_to_name: Any = ... - match: Any = ... - info: Any = ... - def __init__(self, column, _constraint: Optional[Any] = ..., use_alter: bool = ..., - name: Optional[Any] = ..., onupdate: Optional[Any] = ..., ondelete: Optional[Any] = ..., - deferrable: Optional[Any] = ..., initially: Optional[Any] = ..., link_to_name: bool = ..., - match: Optional[Any] = ..., info: Optional[Any] = ..., **dialect_kw) -> None: ... - def copy(self, schema: Optional[Any] = ...): ... - target_fullname: Any = ... - def references(self, table): ... - def get_referent(self, table): ... + constraint: Optional[ForeignKeyConstraint] = ... + parent: Column[Any] = ... + use_alter: bool = ... + name: Optional[str] = ... + onupdate: Optional[str] = ... + ondelete: Optional[str] = ... + deferrable: Optional[bool] = ... + initially: Optional[str] = ... + link_to_name: bool = ... + match: Optional[str] = ... + info: Optional[Mapping[str, Any]] = ... + def __init__(self, column: Union[Column[Any], str], _constraint: Optional[Any] = ..., use_alter: bool = ..., + name: Optional[str] = ..., onupdate: Optional[str] = ..., ondelete: Optional[str] = ..., + deferrable: Optional[bool] = ..., initially: Optional[str] = ..., link_to_name: bool = ..., + match: Optional[str] = ..., info: Optional[Mapping[str, Any]] = ..., **dialect_kw: Any) -> None: ... + def copy(self, schema: Optional[str] = ...) -> ForeignKey: ... + target_fullname: str = ... + def references(self, table: Table) -> bool: ... + def get_referent(self, table: Table) -> Column[Any]: ... @property - def column(self): ... + def column(self) -> Column[Any]: ... class _NotAColumnExpr(object): __clause_element__: Any = ... @@ -120,171 +150,183 @@ class DefaultGenerator(_NotAColumnExpr, SchemaItem): __visit_name__: str = ... is_sequence: bool = ... is_server_default: bool = ... - column: Any = ... - for_update: Any = ... + column: Column[Any] = ... + for_update: bool = ... def __init__(self, for_update: bool = ...) -> None: ... - def execute(self, bind: Optional[Any] = ..., **kwargs): ... + def execute(self, bind: Optional[Union[Engine, Connection]] = ..., **kwargs: Any) -> Any: ... @property - def bind(self): ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... class ColumnDefault(DefaultGenerator): arg: Any = ... - def __init__(self, arg, **kwargs) -> None: ... + def __init__(self, arg: Any, **kwargs: Any) -> None: ... @property - def is_callable(self): ... + def is_callable(self) -> bool: ... @property - def is_clause_element(self): ... + def is_clause_element(self) -> bool: ... @property - def is_scalar(self): ... + def is_scalar(self) -> bool: ... __visit_name__: Any = ... class Sequence(DefaultGenerator, Generic[_T]): __visit_name__: str = ... is_sequence: bool = ... - name: Any = ... - start: Any = ... - increment: Any = ... - minvalue: Any = ... - maxvalue: Any = ... - nominvalue: Any = ... - nomaxvalue: Any = ... - cycle: Any = ... - optional: Any = ... - schema: Any = ... - metadata: Any = ... - def __init__(self, name, start: Optional[Any] = ..., increment: Optional[Any] = ..., - minvalue: Optional[Any] = ..., maxvalue: Optional[Any] = ..., nominvalue: Optional[Any] = ..., - nomaxvalue: Optional[Any] = ..., cycle: Optional[Any] = ..., schema: Optional[Any] = ..., - optional: bool = ..., quote: Optional[Any] = ..., metadata: Optional[Any] = ..., - quote_schema: Optional[Any] = ..., for_update: bool = ...) -> None: ... + name: str = ... + start: Optional[int] = ... + increment: Optional[int] = ... + minvalue: Optional[int] = ... + maxvalue: Optional[int] = ... + nominvalue: Optional[int] = ... + nomaxvalue: Optional[int] = ... + cycle: Optional[bool] = ... + optional: bool = ... + schema: Optional[str] = ... + metadata: Optional[MetaData] = ... + def __init__(self, name: str, start: Optional[int] = ..., increment: Optional[int] = ..., + minvalue: Optional[int] = ..., maxvalue: Optional[int] = ..., nominvalue: Optional[int] = ..., + nomaxvalue: Optional[int] = ..., cycle: Optional[bool] = ..., schema: Optional[str] = ..., + optional: bool = ..., quote: Optional[bool] = ..., metadata: Optional[MetaData] = ..., + quote_schema: Optional[bool] = ..., for_update: bool = ...) -> None: ... @property - def is_callable(self): ... + def is_callable(self) -> bool: ... @property - def is_clause_element(self): ... - def next_value(self): ... + def is_clause_element(self) -> bool: ... + def next_value(self) -> functions.next_value[_T]: ... @property - def bind(self): ... - def create(self, bind: Optional[Any] = ..., checkfirst: bool = ...): ... - def drop(self, bind: Optional[Any] = ..., checkfirst: bool = ...): ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... + def create(self, bind: Optional[Union[Engine, Connection]] = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Optional[Union[Engine, Connection]] = ..., checkfirst: bool = ...) -> None: ... class FetchedValue(_NotAColumnExpr, SchemaEventTarget): is_server_default: bool = ... reflected: bool = ... has_argument: bool = ... - for_update: Any = ... + for_update: bool = ... def __init__(self, for_update: bool = ...) -> None: ... class DefaultClause(FetchedValue): has_argument: bool = ... arg: Any = ... - reflected: Any = ... - def __init__(self, arg, for_update: bool = ..., _reflected: bool = ...) -> None: ... + reflected: bool = ... + def __init__(self, arg: Any, for_update: bool = ..., _reflected: bool = ...) -> None: ... class PassiveDefault(DefaultClause): - def __init__(self, *arg, **kw) -> None: ... + def __init__(self, *arg: Any, **kw: Any) -> None: ... class Constraint(DialectKWArgs, SchemaItem): __visit_name__: str = ... - name: Any = ... - deferrable: Any = ... - initially: Any = ... - info: Any = ... - def __init__(self, name: Optional[Any] = ..., deferrable: Optional[Any] = ..., - initially: Optional[Any] = ..., _create_rule: Optional[Any] = ..., - info: Optional[Any] = ..., _type_bound: bool = ..., **dialect_kw) -> None: ... + name: Optional[str] = ... + deferrable: Optional[bool] = ... + initially: Optional[str] = ... + info: Optional[Mapping[str, Any]] = ... + def __init__(self, name: Optional[str] = ..., deferrable: Optional[bool] = ..., + initially: Optional[str] = ..., _create_rule: Optional[Callable[[DDLCompiler], bool]] = ..., + info: Optional[Mapping[str, Any]] = ..., _type_bound: bool = ..., **dialect_kw: Any) -> None: ... @property - def table(self): ... - def copy(self, **kw): ... + def table(self) -> Table: ... + def copy(self, **kw: Any) -> Any: ... class ColumnCollectionMixin(object): columns: ColumnCollection = ... - def __init__(self, *columns, **kw) -> None: ... + def __init__(self, *columns: Union[Column[Any], str], **kw: Any) -> None: ... + +_CCC = TypeVar('_CCC', bound=ColumnCollectionConstraint) class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint): - def __init__(self, *columns, **kw) -> None: ... - def __contains__(self, x): ... - def copy(self, **kw): ... - def contains_column(self, col): ... - def __iter__(self): ... - def __len__(self): ... + def __init__(self, *columns: Union[Column[Any], str], name: Optional[str] = ..., deferrable: Optional[bool] = ..., + initially: Optional[str] = ..., _create_rule: Optional[Callable[[DDLCompiler], bool]] = ..., + info: Optional[Mapping[str, Any]] = ..., _type_bound: bool = ..., **dialect_kw: Any) -> None: ... + def __contains__(self, x: Any) -> bool: ... + def copy(self: _CCC, **kw: Any) -> _CCC: ... + def contains_column(self, col: Column[Any]) -> bool: ... + def __iter__(self) -> Iterator[Column[Any]]: ... + def __len__(self) -> int: ... class CheckConstraint(ColumnCollectionConstraint): - sqltext: Any = ... - def __init__(self, sqltext, name: Optional[Any] = ..., deferrable: Optional[Any] = ..., - initially: Optional[Any] = ..., table: Optional[Any] = ..., info: Optional[Any] = ..., - _create_rule: Optional[Any] = ..., _autoattach: bool = ..., _type_bound: bool = ...) -> None: ... + sqltext: str = ... + def __init__(self, sqltext: str, name: Optional[str] = ..., deferrable: Optional[bool] = ..., + initially: Optional[str] = ..., table: Optional[Table] = ..., info: Optional[Mapping[str, Any]] = ..., + _create_rule: Optional[Callable[[DDLCompiler], bool]] = ..., _autoattach: bool = ..., + _type_bound: bool = ...) -> None: ... __visit_name__: Any = ... - def copy(self, target_table: Optional[Any] = ..., **kw): ... + def copy(self, target_table: Optional[Table] = ..., **kw: Any) -> CheckConstraint: ... class ForeignKeyConstraint(ColumnCollectionConstraint): __visit_name__: str = ... - onupdate: Any = ... - ondelete: Any = ... - link_to_name: Any = ... - use_alter: Any = ... - match: Any = ... - elements: Any = ... - def __init__(self, columns, refcolumns, name: Optional[Any] = ..., onupdate: Optional[Any] = ..., - ondelete: Optional[Any] = ..., deferrable: Optional[Any] = ..., initially: Optional[Any] = ..., - use_alter: bool = ..., link_to_name: bool = ..., match: Optional[Any] = ..., - table: Optional[Any] = ..., info: Optional[Any] = ..., **dialect_kw) -> None: ... + onupdate: Optional[str] = ... + ondelete: Optional[str] = ... + link_to_name: bool = ... + use_alter: bool = ... + match: Optional[str] = ... + elements: List[ForeignKey] = ... + def __init__(self, columns: Sequence[str], refcolumns: Sequence[Union[str, Column[Any]]], name: Optional[str] = ..., + onupdate: Optional[str] = ..., ondelete: Optional[str] = ..., deferrable: Optional[bool] = ..., + initially: Optional[str] = ..., use_alter: bool = ..., link_to_name: bool = ..., match: Optional[str] = ..., + table: Optional[Table] = ..., info: Optional[Mapping[str, Any]] = ..., **dialect_kw: Any) -> None: ... @property - def referred_table(self): ... + def referred_table(self) -> Table: ... @property - def column_keys(self): ... - def copy(self, schema: Optional[Any] = ..., target_table: Optional[Any] = ..., **kw): ... + def column_keys(self) -> List[str]: ... + def copy(self, schema: Optional[str] = ..., target_table: Optional[Table] = ..., **kw: Any) -> ForeignKeyConstraint: ... class PrimaryKeyConstraint(ColumnCollectionConstraint): __visit_name__: str = ... - def __init__(self, *columns, **kw) -> None: ... + def __init__(self, *columns: Union[Column[Any], str], name: Optional[str] = ..., deferrable: Optional[bool] = ..., + initially: Optional[str] = ..., _create_rule: Optional[Callable[[DDLCompiler], bool]] = ..., + info: Optional[Mapping[str, Any]] = ..., _type_bound: bool = ..., **dialect_kw: Any) -> None: ... @property - def columns_autoinc_first(self): ... + def columns_autoinc_first(self) -> List[Column[Any]]: ... class UniqueConstraint(ColumnCollectionConstraint): __visit_name__: str = ... +_I = TypeVar('_I', bound=Index) + class Index(DialectKWArgs, ColumnCollectionMixin, SchemaItem): __visit_name__: str = ... - table: Any = ... - expressions: Any = ... - name: Any = ... - unique: Any = ... - info: Any = ... - def __init__(self, name, *expressions, **kw) -> None: ... + table: Optional[Table] = ... + expressions: List[Union[Column[Any], str]] = ... + name: str = ... + unique: bool = ... + info: Optional[Mapping[str, Any]] = ... + def __init__(self, name: str, *expressions: Union[Column[Any], str], unique: bool = ..., quote: Optional[bool] = ..., + info: Optional[Mapping[str, Any]] = ..., **kw: Any) -> None: ... @property - def bind(self): ... - def create(self, bind: Optional[Any] = ...): ... - def drop(self, bind: Optional[Any] = ...): ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... + def create(self: _I, bind: Optional[Union[Engine, Connection]] = ...) -> _I: ... + def drop(self, bind: Optional[Union[Engine, Connection]] = ...) -> None: ... -DEFAULT_NAMING_CONVENTION: Any = ... +DEFAULT_NAMING_CONVENTION: util.immutabledict[str, str] = ... class MetaData(SchemaItem): __visit_name__: str = ... - tables: Any = ... - schema: Any = ... - naming_convention: Any = ... - info: Any = ... - def __init__(self, bind: Optional[Any] = ..., reflect: bool = ..., schema: Optional[Any] = ..., - quote_schema: Optional[Any] = ..., naming_convention: Any = ..., - info: Optional[Any] = ...) -> None: ... - def __contains__(self, table_or_key): ... - def is_bound(self): ... - def bind(self): ... - def clear(self): ... - def remove(self, table): ... + tables: util.immutabledict[str, Table] = ... + schema: Optional[str] = ... + naming_convention: Mapping[Union[str, Index, Constraint], str] = ... + info: Optional[Mapping[str, Any]] = ... + def __init__(self, bind: Optional[Union[Engine, Connection]] = ..., reflect: bool = ..., schema: Optional[str] = ..., + quote_schema: Optional[bool] = ..., naming_convention: Mapping[Union[str, Index, Constraint], str] = ..., + info: Optional[Mapping[str, Any]] = ...) -> None: ... + def __contains__(self, table_or_key: Union[str, Table]) -> bool: ... + def is_bound(self) -> bool: ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... + def clear(self) -> None: ... + def remove(self, table: Table) -> None: ... @property - def sorted_tables(self): ... - def reflect(self, bind: Optional[Any] = ..., schema: Optional[Any] = ..., views: bool = ..., - only: Optional[Any] = ..., extend_existing: bool = ..., autoload_replace: bool = ..., - **dialect_kwargs): ... - def append_ddl_listener(self, event_name, listener): ... - def create_all(self, bind: Optional[Any] = ..., tables: Optional[Any] = ..., checkfirst: bool = ...): ... - def drop_all(self, bind: Optional[Any] = ..., tables: Optional[Any] = ..., checkfirst: bool = ...): ... + def sorted_tables(self) -> List[Table]: ... + def reflect(self, bind: Optional[Connectable] = ..., schema: Optional[str] = ..., views: bool = ..., + only: Optional[Union[Sequence[str], Callable[[str, MetaData], bool]]] = ..., extend_existing: bool = ..., + autoload_replace: bool = ..., **dialect_kwargs: Any) -> None: ... + def append_ddl_listener(self, event_name: str, listener: Callable[[str, MetaData, Connection], None]) -> None: ... + def create_all(self, bind: Optional[Connectable] = ..., tables: Optional[Sequence[Table]] = ..., + checkfirst: bool = ...) -> None: ... + def drop_all(self, bind: Optional[Connectable] = ..., tables: Optional[Sequence[Table]] = ..., + checkfirst: bool = ...) -> None: ... class ThreadLocalMetaData(MetaData): __visit_name__: str = ... - context: Any = ... + context: threading.local = ... def __init__(self) -> None: ... - def bind(self): ... - def is_bound(self): ... - def dispose(self): ... + def bind(self) -> Optional[Union[Engine, Connection]]: ... + def is_bound(self) -> bool: ... + def dispose(self) -> None: ...