Skip to content

Commit 3ea39a7

Browse files
herbgvanrossum
authored andcommitted
update constraints definition for 2.7 sqlalchemy (python#630)
1 parent bfbe4f8 commit 3ea39a7

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

third_party/2.7/sqlalchemy/sql/schema.pyi

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,22 @@ class SchemaItem(SchemaEventTarget, visitors.Visitable):
2222

2323
class Table(DialectKWArgs, SchemaItem, TableClause):
2424
def __init__(self, name, metadata, *args, **kwargs): ...
25-
def delete(self, *args, **kwargs): ...
26-
def insert(self, *args, **kwargs): ...
27-
def select(self, *args, **kwargs): ...
28-
def update(self, *args, **kwargs): ...
25+
@property
26+
def key(self): ...
27+
@property
28+
def primary_key(self): ...
29+
def __repr__(self): ...
30+
def __str__(self): ...
31+
def append_column(self, column): ...
32+
def append_constraint(self, constraint): ...
33+
def append_ddl_listener(self, event, listener): ...
34+
def get_children(self, column_collections=True, schema_visitor=False, **kwargs): ...
35+
def exists(self, bind=None): ...
36+
def create(self, bind=None, checkfirst=False): ...
37+
def drop(self, bind=None, checkfirst=False): ...
38+
def tometadata(self, metadata, schema=None): ...
2939
c = ... # type: ColumnCollection
40+
constraints = ... # type: Set[Constraint]
3041

3142

3243
class Column(SchemaItem, ColumnClause):
@@ -76,7 +87,17 @@ class Sequence(DefaultGenerator): ...
7687
class FetchedValue(_NotAColumnExpr, SchemaEventTarget): ...
7788
class DefaultClause(FetchedValue): ...
7889
class PassiveDefault(DefaultClause): ...
79-
class Constraint(DialectKWArgs, SchemaItem): ...
90+
91+
class Constraint(DialectKWArgs, SchemaItem):
92+
def __init__(self, name=None, deferrable=None, initially=None): ...
93+
def __contains__(self, x): ...
94+
def contains_column(self, col): ...
95+
def keys(self): ...
96+
def __add__(self, other): ...
97+
def __iter__(self): ...
98+
def __len__(self): ...
99+
def copy(self, **kw): ...
100+
80101
class ColumnCollectionMixin(object):
81102
columns = ... # type: Any
82103
def __init__(self, *columns, **kw): ...

third_party/2.7/sqlalchemy/sql/selectable.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ from .elements import ClauseElement, TextClause, ClauseList, \
44
Grouping, UnaryExpression, BindParameter
55
from .annotation import Annotated
66
from .visitors import Visitable
7+
from .. import util
78

89
def subquery(alias, *args, **kwargs): ...
910
def alias(selectable, name=..., flat: bool=...): ...
@@ -47,7 +48,20 @@ class Join(FromClause): ...
4748
class Alias(FromClause): ...
4849
class CTE(Generative, HasSuffixes, Alias): ...
4950
class FromGrouping(FromClause): ...
50-
class TableClause(Immutable, FromClause): ...
51+
52+
class TableClause(Immutable, FromClause):
53+
def __init__(self, name, *columns): ...
54+
def _export_columns(self): ...
55+
@util.memoized_property
56+
def description(self): ...
57+
def append_column(self, c): ...
58+
def get_children(self, **kwargs): ...
59+
def count(self, whereclause=None, **params): ...
60+
def insert(self, values=None, inline=False, **kwargs): ...
61+
def update(self, whereclause=None, values=None, inline=False, **kwargs): ...
62+
def delete(self, whereclause=None, **kwargs): ...
63+
@property
64+
def _from_objects(self): ...
5165

5266
class ForUpdateArg(ClauseElement): ...
5367
class SelectBase(Executable, FromClause): ...

0 commit comments

Comments
 (0)