@@ -5,13 +5,16 @@ from typing import Generic
5
5
from typing import Iterable
6
6
from typing import Iterator
7
7
from typing import List
8
+ from typing import Mapping
8
9
from typing import Optional
9
10
from typing import overload
10
11
from typing import Set
11
12
from typing import Type
12
13
from typing import TypeVar
13
14
from typing import Union
14
15
16
+ from typing_extensions import Literal
17
+
15
18
from . import functions
16
19
from . import roles
17
20
from . import sqltypes
@@ -22,6 +25,7 @@ from .base import DialectKWArgs
22
25
from .base import SchemaEventTarget
23
26
from .elements import ClauseElement
24
27
from .elements import ColumnClause
28
+ from .elements import TextClause
25
29
from .selectable import TableClause
26
30
from .. import util
27
31
from ..engine import Connection
@@ -121,40 +125,105 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause[_TE]):
121
125
primary_key : bool = ...
122
126
nullable : bool = ...
123
127
default : Optional [Any ] = ...
124
- server_default : Optional [Any ] = ...
128
+ server_default : Optional [Union [ FetchedValue , str , TextClause ] ] = ...
125
129
server_onupdate : Optional [FetchedValue ] = ...
126
130
index : Optional [bool ] = ...
127
131
unique : Optional [bool ] = ...
128
132
system : bool = ...
129
133
doc : Optional [str ] = ...
130
134
onupdate : Optional [Any ] = ...
131
- autoincrement : Union [bool , str ] = ...
135
+ autoincrement : Union [bool , Literal [ "auto" , "ignore_fk" ] ] = ...
132
136
constraints : Set [Constraint ] = ...
133
137
foreign_keys : Set [ForeignKey ] = ...
134
138
comment : Optional [str ] = ...
135
139
computed : Optional [Computed ] = ...
136
140
identity : Optional [Identity ] = ...
137
141
@overload
138
142
def __init__ (
139
- self , name : str , typ : Union [_TE , Type [_TE ]], * args : Any , ** kwargs : Any
143
+ self : Column [sqltypes .NullType ],
144
+ __name : str ,
145
+ * args : SchemaEventTarget ,
146
+ autoincrement : Union [bool , Literal ["auto" , "ignore_fk" ]] = ...,
147
+ default : Optional [Any ] = ...,
148
+ doc : Optional [str ] = ...,
149
+ key : Optional [str ] = ...,
150
+ index : Optional [bool ] = ...,
151
+ info : Mapping [Any , Any ] = ...,
152
+ nullable : bool = ...,
153
+ onupdate : Optional [Any ] = ...,
154
+ primary_key : bool = ...,
155
+ server_default : Optional [Union [FetchedValue , str , TextClause ]] = ...,
156
+ server_onupdate : Optional [FetchedValue ] = ...,
157
+ quote : Optional [bool ] = ...,
158
+ unique : Optional [bool ] = ...,
159
+ system : bool = ...,
160
+ comment : Optional [str ] = ...,
161
+ ** kwargs : Any ,
140
162
) -> None : ...
141
163
@overload
142
164
def __init__ (
143
- self , typ : Union [_TE , Type [_TE ]], * args : Any , ** kwargs : Any
165
+ self : Column [sqltypes .NullType ],
166
+ * args : SchemaEventTarget ,
167
+ autoincrement : Union [bool , Literal ["auto" , "ignore_fk" ]] = ...,
168
+ default : Optional [Any ] = ...,
169
+ doc : Optional [str ] = ...,
170
+ key : Optional [str ] = ...,
171
+ index : Optional [bool ] = ...,
172
+ info : Mapping [Any , Any ] = ...,
173
+ nullable : bool = ...,
174
+ onupdate : Optional [Any ] = ...,
175
+ primary_key : bool = ...,
176
+ server_default : Optional [Union [FetchedValue , str , TextClause ]] = ...,
177
+ server_onupdate : Optional [FetchedValue ] = ...,
178
+ quote : Optional [bool ] = ...,
179
+ unique : Optional [bool ] = ...,
180
+ system : bool = ...,
181
+ comment : Optional [str ] = ...,
182
+ ** kwargs : Any ,
144
183
) -> None : ...
145
184
@overload
146
185
def __init__ (
147
- self : Column [sqltypes .NullType ],
148
- name : str ,
149
- typ : None = ...,
150
- * args : Any ,
186
+ self ,
187
+ __name : str ,
188
+ __type : Union [_TE , Type [_TE ]],
189
+ * args : SchemaEventTarget ,
190
+ autoincrement : Union [bool , Literal ["auto" , "ignore_fk" ]] = ...,
191
+ default : Optional [Any ] = ...,
192
+ doc : Optional [str ] = ...,
193
+ key : Optional [str ] = ...,
194
+ index : Optional [bool ] = ...,
195
+ info : Mapping [Any , Any ] = ...,
196
+ nullable : bool = ...,
197
+ onupdate : Optional [Any ] = ...,
198
+ primary_key : bool = ...,
199
+ server_default : Optional [Union [FetchedValue , str , TextClause ]] = ...,
200
+ server_onupdate : Optional [FetchedValue ] = ...,
201
+ quote : Optional [bool ] = ...,
202
+ unique : Optional [bool ] = ...,
203
+ system : bool = ...,
204
+ comment : Optional [str ] = ...,
151
205
** kwargs : Any ,
152
206
) -> None : ...
153
207
@overload
154
208
def __init__ (
155
- self : Column [sqltypes .NullType ],
156
- typ : None = ...,
157
- * args : Any ,
209
+ self ,
210
+ __type : Union [_TE , Type [_TE ]],
211
+ * args : SchemaEventTarget ,
212
+ autoincrement : Union [bool , Literal ["auto" , "ignore_fk" ]] = ...,
213
+ default : Optional [Any ] = ...,
214
+ doc : Optional [str ] = ...,
215
+ key : Optional [str ] = ...,
216
+ index : Optional [bool ] = ...,
217
+ info : Mapping [Any , Any ] = ...,
218
+ nullable : bool = ...,
219
+ onupdate : Optional [Any ] = ...,
220
+ primary_key : bool = ...,
221
+ server_default : Optional [Union [FetchedValue , str , TextClause ]] = ...,
222
+ server_onupdate : Optional [FetchedValue ] = ...,
223
+ quote : Optional [bool ] = ...,
224
+ unique : Optional [bool ] = ...,
225
+ system : bool = ...,
226
+ comment : Optional [str ] = ...,
158
227
** kwargs : Any ,
159
228
) -> None : ...
160
229
def references (self , column : Column [Any ]) -> bool : ...
0 commit comments