blob: f1792f8973b85a8ea48c167585727175b0d8091b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
import sys
from sqlalchemy.testing.requirements import Requirements
from alembic import util
from alembic.util import sqla_compat
from ..testing import exclusions
class SuiteRequirements(Requirements):
@property
def schemas(self):
"""Target database must support external schemas, and have one
named 'test_schema'."""
return exclusions.open()
@property
def autocommit_isolation(self):
"""target database should support 'AUTOCOMMIT' isolation level"""
return exclusions.closed()
@property
def unique_constraint_reflection(self):
def doesnt_have_check_uq_constraints(config):
from sqlalchemy import inspect
insp = inspect(config.db)
try:
insp.get_unique_constraints("x")
except NotImplementedError:
return True
except TypeError:
return True
except Exception:
pass
return False
return exclusions.skip_if(doesnt_have_check_uq_constraints)
@property
def sequences(self):
"""Target database must support SEQUENCEs."""
return exclusions.only_if(
[lambda config: config.db.dialect.supports_sequences],
"no sequence support",
)
@property
def foreign_key_match(self):
return exclusions.open()
@property
def foreign_key_constraint_reflection(self):
return exclusions.open()
@property
def check_constraints_w_enforcement(self):
"""Target database must support check constraints
and also enforce them."""
return exclusions.open()
@property
def reflects_pk_names(self):
return exclusions.closed()
@property
def reflects_fk_options(self):
return exclusions.closed()
@property
def sqlalchemy_13(self):
return exclusions.skip_if(
lambda config: not util.sqla_13,
"SQLAlchemy 1.3 or greater required",
)
@property
def sqlalchemy_14(self):
return exclusions.skip_if(
lambda config: not util.sqla_14,
"SQLAlchemy 1.4 or greater required",
)
@property
def python3(self):
return exclusions.skip_if(
lambda: sys.version_info < (3,), "Python version 3.xx is required."
)
@property
def comments(self):
return exclusions.only_if(
lambda config: config.db.dialect.supports_comments
)
@property
def alter_column(self):
return exclusions.open()
@property
def computed_columns(self):
return exclusions.closed()
@property
def computed_columns_api(self):
return exclusions.only_if(
exclusions.BooleanPredicate(sqla_compat.has_computed)
)
@property
def computed_reflects_normally(self):
return exclusions.only_if(
exclusions.BooleanPredicate(sqla_compat.has_computed_reflection)
)
@property
def computed_reflects_as_server_default(self):
return exclusions.closed()
@property
def computed_doesnt_reflect_as_server_default(self):
return exclusions.closed()
@property
def autoincrement_on_composite_pk(self):
return exclusions.closed()
@property
def fk_ondelete_is_reflected(self):
return exclusions.closed()
@property
def fk_onupdate_is_reflected(self):
return exclusions.closed()
@property
def fk_onupdate(self):
return exclusions.open()
@property
def fk_ondelete_restrict(self):
return exclusions.open()
@property
def fk_onupdate_restrict(self):
return exclusions.open()
@property
def fk_ondelete_noaction(self):
return exclusions.open()
@property
def fk_initially(self):
return exclusions.closed()
@property
def fk_deferrable(self):
return exclusions.closed()
@property
def fk_deferrable_is_reflected(self):
return exclusions.closed()
@property
def fk_names(self):
return exclusions.open()
@property
def integer_subtype_comparisons(self):
return exclusions.open()
@property
def no_name_normalize(self):
return exclusions.skip_if(
lambda config: config.db.dialect.requires_name_normalize
)
@property
def identity_columns(self):
return exclusions.closed()
@property
def identity_columns_alter(self):
return exclusions.closed()
@property
def identity_columns_api(self):
return exclusions.only_if(
exclusions.BooleanPredicate(sqla_compat.has_identity)
)
@property
def supports_identity_on_null(self):
return exclusions.closed()
|