alembic 1.13.0__py3-none-any.whl → 1.13.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alembic/__init__.py +1 -1
- alembic/autogenerate/__init__.py +10 -10
- alembic/autogenerate/api.py +6 -4
- alembic/autogenerate/compare.py +5 -4
- alembic/autogenerate/render.py +9 -9
- alembic/autogenerate/rewriter.py +26 -13
- alembic/command.py +3 -1
- alembic/config.py +20 -9
- alembic/context.pyi +10 -5
- alembic/ddl/__init__.py +1 -1
- alembic/ddl/_autogen.py +4 -2
- alembic/ddl/base.py +12 -9
- alembic/ddl/impl.py +5 -2
- alembic/ddl/mssql.py +4 -1
- alembic/ddl/mysql.py +5 -3
- alembic/ddl/oracle.py +4 -1
- alembic/ddl/postgresql.py +16 -9
- alembic/ddl/sqlite.py +8 -6
- alembic/op.pyi +46 -8
- alembic/operations/base.py +70 -14
- alembic/operations/batch.py +7 -8
- alembic/operations/ops.py +52 -30
- alembic/operations/schemaobj.py +5 -4
- alembic/operations/toimpl.py +3 -0
- alembic/runtime/environment.py +15 -6
- alembic/runtime/migration.py +27 -11
- alembic/script/base.py +13 -15
- alembic/script/revision.py +30 -17
- alembic/script/write_hooks.py +3 -0
- alembic/util/__init__.py +31 -31
- alembic/util/compat.py +25 -8
- alembic/util/langhelpers.py +78 -33
- alembic/util/messaging.py +6 -3
- alembic/util/pyfiles.py +7 -3
- alembic/util/sqla_compat.py +43 -14
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/METADATA +1 -1
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/RECORD +41 -41
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/LICENSE +0 -0
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/WHEEL +0 -0
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/entry_points.txt +0 -0
- {alembic-1.13.0.dist-info → alembic-1.13.1.dist-info}/top_level.txt +0 -0
alembic/util/sqla_compat.py
CHANGED
@@ -1,13 +1,20 @@
|
|
1
|
+
# mypy: allow-untyped-defs, allow-incomplete-defs, allow-untyped-calls
|
2
|
+
# mypy: no-warn-return-any, allow-any-generics
|
3
|
+
|
1
4
|
from __future__ import annotations
|
2
5
|
|
3
6
|
import contextlib
|
4
7
|
import re
|
5
8
|
from typing import Any
|
9
|
+
from typing import Callable
|
6
10
|
from typing import Dict
|
7
11
|
from typing import Iterable
|
8
12
|
from typing import Iterator
|
9
13
|
from typing import Mapping
|
10
14
|
from typing import Optional
|
15
|
+
from typing import Protocol
|
16
|
+
from typing import Set
|
17
|
+
from typing import Type
|
11
18
|
from typing import TYPE_CHECKING
|
12
19
|
from typing import TypeVar
|
13
20
|
from typing import Union
|
@@ -18,7 +25,6 @@ from sqlalchemy import schema
|
|
18
25
|
from sqlalchemy import sql
|
19
26
|
from sqlalchemy import types as sqltypes
|
20
27
|
from sqlalchemy.engine import url
|
21
|
-
from sqlalchemy.ext.compiler import compiles
|
22
28
|
from sqlalchemy.schema import CheckConstraint
|
23
29
|
from sqlalchemy.schema import Column
|
24
30
|
from sqlalchemy.schema import ForeignKeyConstraint
|
@@ -33,6 +39,7 @@ from sqlalchemy.sql.visitors import traverse
|
|
33
39
|
from typing_extensions import TypeGuard
|
34
40
|
|
35
41
|
if TYPE_CHECKING:
|
42
|
+
from sqlalchemy import ClauseElement
|
36
43
|
from sqlalchemy import Index
|
37
44
|
from sqlalchemy import Table
|
38
45
|
from sqlalchemy.engine import Connection
|
@@ -51,6 +58,11 @@ if TYPE_CHECKING:
|
|
51
58
|
_CE = TypeVar("_CE", bound=Union["ColumnElement[Any]", "SchemaItem"])
|
52
59
|
|
53
60
|
|
61
|
+
class _CompilerProtocol(Protocol):
|
62
|
+
def __call__(self, element: Any, compiler: Any, **kw: Any) -> str:
|
63
|
+
...
|
64
|
+
|
65
|
+
|
54
66
|
def _safe_int(value: str) -> Union[int, str]:
|
55
67
|
try:
|
56
68
|
return int(value)
|
@@ -70,7 +82,7 @@ sqla_2 = _vers >= (2,)
|
|
70
82
|
sqlalchemy_version = __version__
|
71
83
|
|
72
84
|
try:
|
73
|
-
from sqlalchemy.sql.naming import _NONE_NAME as _NONE_NAME
|
85
|
+
from sqlalchemy.sql.naming import _NONE_NAME as _NONE_NAME # type: ignore[attr-defined] # noqa: E501
|
74
86
|
except ImportError:
|
75
87
|
from sqlalchemy.sql.elements import _NONE_NAME as _NONE_NAME # type: ignore # noqa: E501
|
76
88
|
|
@@ -79,8 +91,18 @@ class _Unsupported:
|
|
79
91
|
"Placeholder for unsupported SQLAlchemy classes"
|
80
92
|
|
81
93
|
|
94
|
+
if TYPE_CHECKING:
|
95
|
+
|
96
|
+
def compiles(
|
97
|
+
element: Type[ClauseElement], *dialects: str
|
98
|
+
) -> Callable[[_CompilerProtocol], _CompilerProtocol]:
|
99
|
+
...
|
100
|
+
|
101
|
+
else:
|
102
|
+
from sqlalchemy.ext.compiler import compiles
|
103
|
+
|
82
104
|
try:
|
83
|
-
from sqlalchemy import Computed
|
105
|
+
from sqlalchemy import Computed as Computed
|
84
106
|
except ImportError:
|
85
107
|
if not TYPE_CHECKING:
|
86
108
|
|
@@ -94,7 +116,7 @@ else:
|
|
94
116
|
has_computed_reflection = _vers >= (1, 3, 16)
|
95
117
|
|
96
118
|
try:
|
97
|
-
from sqlalchemy import Identity
|
119
|
+
from sqlalchemy import Identity as Identity
|
98
120
|
except ImportError:
|
99
121
|
if not TYPE_CHECKING:
|
100
122
|
|
@@ -250,7 +272,7 @@ def _idx_table_bound_expressions(idx: Index) -> Iterable[ColumnElement[Any]]:
|
|
250
272
|
|
251
273
|
def _copy(schema_item: _CE, **kw) -> _CE:
|
252
274
|
if hasattr(schema_item, "_copy"):
|
253
|
-
return schema_item._copy(**kw)
|
275
|
+
return schema_item._copy(**kw)
|
254
276
|
else:
|
255
277
|
return schema_item.copy(**kw) # type: ignore[union-attr]
|
256
278
|
|
@@ -368,7 +390,12 @@ else:
|
|
368
390
|
return type_.impl, type_.mapping
|
369
391
|
|
370
392
|
|
371
|
-
def _fk_spec(constraint):
|
393
|
+
def _fk_spec(constraint: ForeignKeyConstraint) -> Any:
|
394
|
+
if TYPE_CHECKING:
|
395
|
+
assert constraint.columns is not None
|
396
|
+
assert constraint.elements is not None
|
397
|
+
assert isinstance(constraint.parent, Table)
|
398
|
+
|
372
399
|
source_columns = [
|
373
400
|
constraint.columns[key].name for key in constraint.column_keys
|
374
401
|
]
|
@@ -397,7 +424,7 @@ def _fk_spec(constraint):
|
|
397
424
|
|
398
425
|
|
399
426
|
def _fk_is_self_referential(constraint: ForeignKeyConstraint) -> bool:
|
400
|
-
spec = constraint.elements[0]._get_colspec()
|
427
|
+
spec = constraint.elements[0]._get_colspec()
|
401
428
|
tokens = spec.split(".")
|
402
429
|
tokens.pop(-1) # colname
|
403
430
|
tablekey = ".".join(tokens)
|
@@ -409,13 +436,13 @@ def _is_type_bound(constraint: Constraint) -> bool:
|
|
409
436
|
# this deals with SQLAlchemy #3260, don't copy CHECK constraints
|
410
437
|
# that will be generated by the type.
|
411
438
|
# new feature added for #3260
|
412
|
-
return constraint._type_bound
|
439
|
+
return constraint._type_bound
|
413
440
|
|
414
441
|
|
415
442
|
def _find_columns(clause):
|
416
443
|
"""locate Column objects within the given expression."""
|
417
444
|
|
418
|
-
cols = set()
|
445
|
+
cols: Set[ColumnElement[Any]] = set()
|
419
446
|
traverse(clause, {}, {"column": cols.add})
|
420
447
|
return cols
|
421
448
|
|
@@ -562,9 +589,7 @@ def _get_constraint_final_name(
|
|
562
589
|
if isinstance(constraint, schema.Index):
|
563
590
|
# name should not be quoted.
|
564
591
|
d = dialect.ddl_compiler(dialect, None) # type: ignore[arg-type]
|
565
|
-
return d._prepared_index_name(
|
566
|
-
constraint
|
567
|
-
)
|
592
|
+
return d._prepared_index_name(constraint)
|
568
593
|
else:
|
569
594
|
# name should not be quoted.
|
570
595
|
return dialect.identifier_preparer.format_constraint(constraint)
|
@@ -608,7 +633,11 @@ def _insert_inline(table: Union[TableClause, Table]) -> Insert:
|
|
608
633
|
|
609
634
|
if sqla_14:
|
610
635
|
from sqlalchemy import create_mock_engine
|
611
|
-
|
636
|
+
|
637
|
+
# weird mypy workaround
|
638
|
+
from sqlalchemy import select as _sa_select
|
639
|
+
|
640
|
+
_select = _sa_select
|
612
641
|
else:
|
613
642
|
from sqlalchemy import create_engine
|
614
643
|
|
@@ -617,7 +646,7 @@ else:
|
|
617
646
|
"postgresql://", strategy="mock", executor=executor
|
618
647
|
)
|
619
648
|
|
620
|
-
def _select(*columns, **kw) -> Select:
|
649
|
+
def _select(*columns, **kw) -> Select:
|
621
650
|
return sql.select(list(columns), **kw) # type: ignore[call-overload]
|
622
651
|
|
623
652
|
|
@@ -1,41 +1,41 @@
|
|
1
|
-
alembic/__init__.py,sha256=
|
1
|
+
alembic/__init__.py,sha256=PMiQT_1tHyC_Od3GDBArBk7r14v8F62_xkzliPq9tLU,63
|
2
2
|
alembic/__main__.py,sha256=373m7-TBh72JqrSMYviGrxCHZo-cnweM8AGF8A22PmY,78
|
3
|
-
alembic/command.py,sha256=
|
4
|
-
alembic/config.py,sha256=
|
3
|
+
alembic/command.py,sha256=jWFNS-wPWA-Klfm0GsPfWh_8sPj4n7rKROJ0zrwhoR0,21712
|
4
|
+
alembic/config.py,sha256=I12lm4V-AXSt-7nvub-Vtx5Zfa68pYP5xSrFQQd45rQ,22256
|
5
5
|
alembic/context.py,sha256=hK1AJOQXJ29Bhn276GYcosxeG7pC5aZRT5E8c4bMJ4Q,195
|
6
|
-
alembic/context.pyi,sha256=
|
6
|
+
alembic/context.pyi,sha256=hUHbSnbSeEEMVkk0gDSXOq4_9edSjYzsjmmf-mL9Iao,31737
|
7
7
|
alembic/environment.py,sha256=MM5lPayGT04H3aeng1H7GQ8HEAs3VGX5yy6mDLCPLT4,43
|
8
8
|
alembic/migration.py,sha256=MV6Fju6rZtn2fTREKzXrCZM6aIBGII4OMZFix0X-GLs,41
|
9
9
|
alembic/op.py,sha256=flHtcsVqOD-ZgZKK2pv-CJ5Cwh-KJ7puMUNXzishxLw,167
|
10
|
-
alembic/op.pyi,sha256=
|
10
|
+
alembic/op.pyi,sha256=8R6SJr1dQharU0blmMJJj23XFO_hk9ZmAQBJBQOeXRU,49816
|
11
11
|
alembic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
alembic/autogenerate/__init__.py,sha256=
|
13
|
-
alembic/autogenerate/api.py,sha256=
|
14
|
-
alembic/autogenerate/compare.py,sha256=
|
15
|
-
alembic/autogenerate/render.py,sha256=
|
16
|
-
alembic/autogenerate/rewriter.py,sha256=
|
17
|
-
alembic/ddl/__init__.py,sha256=
|
18
|
-
alembic/ddl/_autogen.py,sha256=
|
19
|
-
alembic/ddl/base.py,sha256=
|
20
|
-
alembic/ddl/impl.py,sha256=
|
21
|
-
alembic/ddl/mssql.py,sha256=
|
22
|
-
alembic/ddl/mysql.py,sha256=
|
23
|
-
alembic/ddl/oracle.py,sha256=
|
24
|
-
alembic/ddl/postgresql.py,sha256=
|
25
|
-
alembic/ddl/sqlite.py,sha256=
|
12
|
+
alembic/autogenerate/__init__.py,sha256=ntmUTXhjLm4_zmqIwyVaECdpPDn6_u1yM9vYk6-553E,543
|
13
|
+
alembic/autogenerate/api.py,sha256=Oc7MRtDhkSICsQ82fYP9bBMYaAjzzW2X_izM3AQU-OY,22171
|
14
|
+
alembic/autogenerate/compare.py,sha256=3QLK2yCDW37bXbAIXcHGz4YOFlOW8bSfLHJ8bmzgG1M,44938
|
15
|
+
alembic/autogenerate/render.py,sha256=uSbCpkh72mo00xGZ8CJa3teM_gqulCoNtxH0Ey8Ny1k,34939
|
16
|
+
alembic/autogenerate/rewriter.py,sha256=uZWRkTYJoncoEJ5WY1QBRiozjyChqZDJPy4LtcRibjM,7846
|
17
|
+
alembic/ddl/__init__.py,sha256=Df8fy4Vn_abP8B7q3x8gyFwEwnLw6hs2Ljt_bV3EZWE,152
|
18
|
+
alembic/ddl/_autogen.py,sha256=0no9ywWP8gjvO57Ozc2naab4qNusVNn2fiJekjc275g,9179
|
19
|
+
alembic/ddl/base.py,sha256=Jd7oPoAOGjOMcdMUIzSKnTjd8NKnTd7IjBXXyVpDCkU,9955
|
20
|
+
alembic/ddl/impl.py,sha256=vkhkXFpLPJBG9jW2kv_sR5CC5czNd1ERLjLtfLuOFP0,28778
|
21
|
+
alembic/ddl/mssql.py,sha256=ydvgBSaftKYjaBaMyqius66Ta4CICQSj79Og3Ed2atY,14219
|
22
|
+
alembic/ddl/mysql.py,sha256=am221U_UK3wX33tNcXNiOObZV-Pa4CXuv7vN-epF9IU,16788
|
23
|
+
alembic/ddl/oracle.py,sha256=TmoCq_FlbfyWAAk3e_q6mMQU0YmlfIcgKHpRfNMmgr0,6211
|
24
|
+
alembic/ddl/postgresql.py,sha256=dcWLdDSqivzizVCce_H6RnOVAayPXDFfns-NC4-UaA8,29842
|
25
|
+
alembic/ddl/sqlite.py,sha256=wLXhb8bJWRspKQTb-iVfepR4LXYgOuEbUWKX5qwDhIQ,7570
|
26
26
|
alembic/operations/__init__.py,sha256=e0KQSZAgLpTWvyvreB7DWg7RJV_MWSOPVDgCqsd2FzY,318
|
27
|
-
alembic/operations/base.py,sha256=
|
28
|
-
alembic/operations/batch.py,sha256=
|
29
|
-
alembic/operations/ops.py,sha256=
|
30
|
-
alembic/operations/schemaobj.py,sha256
|
31
|
-
alembic/operations/toimpl.py,sha256=
|
27
|
+
alembic/operations/base.py,sha256=LCx4NH5NA2NLWQFaZTqE_p2KgLtqJ76oVcp1Grj-zFM,74004
|
28
|
+
alembic/operations/batch.py,sha256=YqtD4hJ3_RkFxvI7zbmBwxcLEyLHYyWQpsz4l5L85yI,26943
|
29
|
+
alembic/operations/ops.py,sha256=2vtYFhYFDEVq158HwORfGTsobDM7c-t0lewuR7JKw7g,94353
|
30
|
+
alembic/operations/schemaobj.py,sha256=vjoD57QvjbzzA-jyPIXulbOmb5_bGPtxoq58KsKI4Y0,9424
|
31
|
+
alembic/operations/toimpl.py,sha256=SoNY2_gZX2baXTD-pNjpCWnON8D2QBSYQBIjo13-WKA,7115
|
32
32
|
alembic/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
alembic/runtime/environment.py,sha256=
|
34
|
-
alembic/runtime/migration.py,sha256=
|
33
|
+
alembic/runtime/environment.py,sha256=9wSJaePNAXBXvirif_85ql7dSq4bXM1E6pSb2k-6uGI,41508
|
34
|
+
alembic/runtime/migration.py,sha256=Yfv2fa11wiQ0WgoZaFldlWxCPq4dVDOCEOxST_-1VB0,50066
|
35
35
|
alembic/script/__init__.py,sha256=lSj06O391Iy5avWAiq8SPs6N8RBgxkSPjP8wpXcNDGg,100
|
36
|
-
alembic/script/base.py,sha256=
|
37
|
-
alembic/script/revision.py,sha256=
|
38
|
-
alembic/script/write_hooks.py,sha256=
|
36
|
+
alembic/script/base.py,sha256=4gkppn2FKCYDoBgzGkTslcwdyxSabmHvGq0uGKulwbI,37586
|
37
|
+
alembic/script/revision.py,sha256=sfnXQw2UwiXs0E6gEPHBKWuSsB5KyuxZPTrFn__hIEk,62060
|
38
|
+
alembic/script/write_hooks.py,sha256=NGB6NGgfdf7HK6XNNpSKqUCfzxazj-NRUePgFx7MJSM,5036
|
39
39
|
alembic/templates/async/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
|
40
40
|
alembic/templates/async/alembic.ini.mako,sha256=uuhJETLWQuiYcs_jAOXHEjshEJ7VslEc1q4RRj0HWbE,3525
|
41
41
|
alembic/templates/async/env.py,sha256=zbOCf3Y7w2lg92hxSwmG1MM_7y56i_oRH4AKp0pQBYo,2389
|
@@ -67,17 +67,17 @@ alembic/testing/suite/test_autogen_fks.py,sha256=AqFmb26Buex167HYa9dZWOk8x-JlB1O
|
|
67
67
|
alembic/testing/suite/test_autogen_identity.py,sha256=kcuqngG7qXAKPJDX4U8sRzPKHEJECHuZ0DtuaS6tVkk,5824
|
68
68
|
alembic/testing/suite/test_environment.py,sha256=w9F0xnLEbALeR8k6_-Tz6JHvy91IqiTSypNasVzXfZQ,11877
|
69
69
|
alembic/testing/suite/test_op.py,sha256=2XQCdm_NmnPxHGuGj7hmxMzIhKxXNotUsKdACXzE1mM,1343
|
70
|
-
alembic/util/__init__.py,sha256=
|
71
|
-
alembic/util/compat.py,sha256=
|
70
|
+
alembic/util/__init__.py,sha256=KSZ7UT2YzH6CietgUtljVoE3QnGjoFKOi7RL5sgUxrk,1688
|
71
|
+
alembic/util/compat.py,sha256=RjHdQa1NomU3Zlvgfvza0OMiSRQSLRL3xVl3OdUy2UE,2594
|
72
72
|
alembic/util/editor.py,sha256=JIz6_BdgV8_oKtnheR6DZoB7qnrHrlRgWjx09AsTsUw,2546
|
73
73
|
alembic/util/exc.py,sha256=KQTru4zcgAmN4IxLMwLFS56XToUewaXB7oOLcPNjPwg,98
|
74
|
-
alembic/util/langhelpers.py,sha256=
|
75
|
-
alembic/util/messaging.py,sha256=
|
76
|
-
alembic/util/pyfiles.py,sha256=
|
77
|
-
alembic/util/sqla_compat.py,sha256=
|
78
|
-
alembic-1.13.
|
79
|
-
alembic-1.13.
|
80
|
-
alembic-1.13.
|
81
|
-
alembic-1.13.
|
82
|
-
alembic-1.13.
|
83
|
-
alembic-1.13.
|
74
|
+
alembic/util/langhelpers.py,sha256=KYyOjFjJ26evPmrwhdTvLQNXN0bK7AIy5sRdKD91Fvg,10038
|
75
|
+
alembic/util/messaging.py,sha256=BM5OCZ6qmLftFRw5yPSxj539_QmfVwNYoU8qYsDqoJY,3132
|
76
|
+
alembic/util/pyfiles.py,sha256=zltVdcwEJJCPS2gHsQvkHkQakuF6wXiZ6zfwHbGNT0g,3489
|
77
|
+
alembic/util/sqla_compat.py,sha256=toD1S63PgZ6iEteP9bwIf5E7DIUdQPo0UQ_Fn18qWnI,19536
|
78
|
+
alembic-1.13.1.dist-info/LICENSE,sha256=soUmiob0QW6vTQWyrjiAwVb3xZqPk1pAK8BW6vszrwg,1058
|
79
|
+
alembic-1.13.1.dist-info/METADATA,sha256=W1F2NBRkhqW55HiGmEIpdmiRt2skU5wwJd21UHFbSdQ,7390
|
80
|
+
alembic-1.13.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
81
|
+
alembic-1.13.1.dist-info/entry_points.txt,sha256=aykM30soxwGN0pB7etLc1q0cHJbL9dy46RnK9VX4LLw,48
|
82
|
+
alembic-1.13.1.dist-info/top_level.txt,sha256=FwKWd5VsPFC8iQjpu1u9Cn-JnK3-V1RhUCmWqz1cl-s,8
|
83
|
+
alembic-1.13.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|