alembic 1.16.3__py3-none-any.whl → 1.16.5__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/config.py +25 -4
- alembic/ddl/mysql.py +30 -1
- alembic/script/base.py +2 -4
- alembic/testing/__init__.py +1 -0
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/METADATA +1 -1
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/RECORD +11 -11
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/WHEEL +0 -0
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/entry_points.txt +0 -0
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/licenses/LICENSE +0 -0
- {alembic-1.16.3.dist-info → alembic-1.16.5.dist-info}/top_level.txt +0 -0
alembic/__init__.py
CHANGED
alembic/config.py
CHANGED
@@ -426,7 +426,9 @@ class Config:
|
|
426
426
|
|
427
427
|
def get_alembic_option(
|
428
428
|
self, name: str, default: Optional[str] = None
|
429
|
-
) -> Union[
|
429
|
+
) -> Union[
|
430
|
+
None, str, list[str], dict[str, str], list[dict[str, str]], int
|
431
|
+
]:
|
430
432
|
"""Return an option from the "[alembic]" or "[tool.alembic]" section
|
431
433
|
of the configparser-parsed .ini file (e.g. ``alembic.ini``) or
|
432
434
|
toml-parsed ``pyproject.toml`` file.
|
@@ -455,11 +457,26 @@ class Config:
|
|
455
457
|
else:
|
456
458
|
return self._get_toml_config_value(name, default=default)
|
457
459
|
|
460
|
+
def get_alembic_boolean_option(self, name: str) -> bool:
|
461
|
+
if self.file_config.has_option(self.config_ini_section, name):
|
462
|
+
return (
|
463
|
+
self.file_config.get(self.config_ini_section, name) == "true"
|
464
|
+
)
|
465
|
+
else:
|
466
|
+
value = self.toml_alembic_config.get(name, False)
|
467
|
+
if not isinstance(value, bool):
|
468
|
+
raise util.CommandError(
|
469
|
+
f"boolean value expected for TOML parameter {name!r}"
|
470
|
+
)
|
471
|
+
return value
|
472
|
+
|
458
473
|
def _get_toml_config_value(
|
459
474
|
self, name: str, default: Optional[Any] = None
|
460
|
-
) -> Union[
|
475
|
+
) -> Union[
|
476
|
+
None, str, list[str], dict[str, str], list[dict[str, str]], int
|
477
|
+
]:
|
461
478
|
USE_DEFAULT = object()
|
462
|
-
value: Union[None, str, list[str], dict[str, str]] = (
|
479
|
+
value: Union[None, str, list[str], dict[str, str], int] = (
|
463
480
|
self.toml_alembic_config.get(name, USE_DEFAULT)
|
464
481
|
)
|
465
482
|
if value is USE_DEFAULT:
|
@@ -482,8 +499,12 @@ class Config:
|
|
482
499
|
"dict[str, str]",
|
483
500
|
{k: v % (self.toml_args) for k, v in value.items()},
|
484
501
|
)
|
502
|
+
elif isinstance(value, int):
|
503
|
+
return value
|
485
504
|
else:
|
486
|
-
raise util.CommandError(
|
505
|
+
raise util.CommandError(
|
506
|
+
f"unsupported TOML value type for key: {name!r}"
|
507
|
+
)
|
487
508
|
return value
|
488
509
|
|
489
510
|
@util.memoized_property
|
alembic/ddl/mysql.py
CHANGED
@@ -11,6 +11,9 @@ from typing import Union
|
|
11
11
|
|
12
12
|
from sqlalchemy import schema
|
13
13
|
from sqlalchemy import types as sqltypes
|
14
|
+
from sqlalchemy.sql import elements
|
15
|
+
from sqlalchemy.sql import functions
|
16
|
+
from sqlalchemy.sql import operators
|
14
17
|
|
15
18
|
from .base import alter_table
|
16
19
|
from .base import AlterColumn
|
@@ -31,6 +34,7 @@ if TYPE_CHECKING:
|
|
31
34
|
|
32
35
|
from sqlalchemy.dialects.mysql.base import MySQLDDLCompiler
|
33
36
|
from sqlalchemy.sql.ddl import DropConstraint
|
37
|
+
from sqlalchemy.sql.elements import ClauseElement
|
34
38
|
from sqlalchemy.sql.schema import Constraint
|
35
39
|
from sqlalchemy.sql.type_api import TypeEngine
|
36
40
|
|
@@ -47,6 +51,31 @@ class MySQLImpl(DefaultImpl):
|
|
47
51
|
)
|
48
52
|
type_arg_extract = [r"character set ([\w\-_]+)", r"collate ([\w\-_]+)"]
|
49
53
|
|
54
|
+
def render_ddl_sql_expr(
|
55
|
+
self,
|
56
|
+
expr: ClauseElement,
|
57
|
+
is_server_default: bool = False,
|
58
|
+
is_index: bool = False,
|
59
|
+
**kw: Any,
|
60
|
+
) -> str:
|
61
|
+
# apply Grouping to index expressions;
|
62
|
+
# see https://github.com/sqlalchemy/sqlalchemy/blob/
|
63
|
+
# 36da2eaf3e23269f2cf28420ae73674beafd0661/
|
64
|
+
# lib/sqlalchemy/dialects/mysql/base.py#L2191
|
65
|
+
if is_index and (
|
66
|
+
isinstance(expr, elements.BinaryExpression)
|
67
|
+
or (
|
68
|
+
isinstance(expr, elements.UnaryExpression)
|
69
|
+
and expr.modifier not in (operators.desc_op, operators.asc_op)
|
70
|
+
)
|
71
|
+
or isinstance(expr, functions.FunctionElement)
|
72
|
+
):
|
73
|
+
expr = elements.Grouping(expr)
|
74
|
+
|
75
|
+
return super().render_ddl_sql_expr(
|
76
|
+
expr, is_server_default=is_server_default, is_index=is_index, **kw
|
77
|
+
)
|
78
|
+
|
50
79
|
def alter_column(
|
51
80
|
self,
|
52
81
|
table_name: str,
|
@@ -478,7 +507,7 @@ def _mysql_drop_constraint(
|
|
478
507
|
# note that SQLAlchemy as of 1.2 does not yet support
|
479
508
|
# DROP CONSTRAINT for MySQL/MariaDB, so we implement fully
|
480
509
|
# here.
|
481
|
-
if compiler.dialect.is_mariadb:
|
510
|
+
if compiler.dialect.is_mariadb:
|
482
511
|
return "ALTER TABLE %s DROP CONSTRAINT %s" % (
|
483
512
|
compiler.preparer.format_table(constraint.table),
|
484
513
|
compiler.preparer.format_constraint(constraint),
|
alembic/script/base.py
CHANGED
@@ -186,16 +186,14 @@ class ScriptDirectory:
|
|
186
186
|
if prepend_sys_path:
|
187
187
|
sys.path[:0] = prepend_sys_path
|
188
188
|
|
189
|
-
rvl = (
|
190
|
-
config.get_alembic_option("recursive_version_locations") == "true"
|
191
|
-
)
|
189
|
+
rvl = config.get_alembic_boolean_option("recursive_version_locations")
|
192
190
|
return ScriptDirectory(
|
193
191
|
util.coerce_resource_to_filename(script_location),
|
194
192
|
file_template=config.get_alembic_option(
|
195
193
|
"file_template", _default_file_template
|
196
194
|
),
|
197
195
|
truncate_slug_length=truncate_slug_length,
|
198
|
-
sourceless=config.
|
196
|
+
sourceless=config.get_alembic_boolean_option("sourceless"),
|
199
197
|
output_encoding=config.get_alembic_option(
|
200
198
|
"output_encoding", "utf-8"
|
201
199
|
),
|
alembic/testing/__init__.py
CHANGED
@@ -9,6 +9,7 @@ from sqlalchemy.testing import uses_deprecated
|
|
9
9
|
from sqlalchemy.testing.config import combinations
|
10
10
|
from sqlalchemy.testing.config import fixture
|
11
11
|
from sqlalchemy.testing.config import requirements as requires
|
12
|
+
from sqlalchemy.testing.config import Variation
|
12
13
|
from sqlalchemy.testing.config import variation
|
13
14
|
|
14
15
|
from .assertions import assert_raises
|
@@ -1,7 +1,7 @@
|
|
1
|
-
alembic/__init__.py,sha256=
|
1
|
+
alembic/__init__.py,sha256=H_hItDeyDOrQAHc1AFoYXIRN3O3FSxw4zSNiVzz2JlM,63
|
2
2
|
alembic/__main__.py,sha256=373m7-TBh72JqrSMYviGrxCHZo-cnweM8AGF8A22PmY,78
|
3
3
|
alembic/command.py,sha256=pZPQUGSxCjFu7qy0HMe02HJmByM0LOqoiK2AXKfRO3A,24855
|
4
|
-
alembic/config.py,sha256=
|
4
|
+
alembic/config.py,sha256=nfwN_OOFPpee-OY4o10DANh7VG_E4O7bdW00Wx8NNKY,34237
|
5
5
|
alembic/context.py,sha256=hK1AJOQXJ29Bhn276GYcosxeG7pC5aZRT5E8c4bMJ4Q,195
|
6
6
|
alembic/context.pyi,sha256=fdeFNTRc0bUgi7n2eZWVFh6NG-TzIv_0gAcapbfHnKY,31773
|
7
7
|
alembic/environment.py,sha256=MM5lPayGT04H3aeng1H7GQ8HEAs3VGX5yy6mDLCPLT4,43
|
@@ -19,7 +19,7 @@ alembic/ddl/_autogen.py,sha256=Blv2RrHNyF4cE6znCQXNXG5T9aO-YmiwD4Fz-qfoaWA,9275
|
|
19
19
|
alembic/ddl/base.py,sha256=A1f89-rCZvqw-hgWmBbIszRqx94lL6gKLFXE9kHettA,10478
|
20
20
|
alembic/ddl/impl.py,sha256=UL8-iza7CJk_T73lr5fjDLdhxEL56uD-AEjtmESAbLk,30439
|
21
21
|
alembic/ddl/mssql.py,sha256=NzORSIDHUll_g6iH4IyMTXZU1qjKzXrpespKrjWnfLY,14216
|
22
|
-
alembic/ddl/mysql.py,sha256=
|
22
|
+
alembic/ddl/mysql.py,sha256=LSfwiABdT54sKY_uQ-h6RvjbGiG-1vCSDkO3ECeq3qM,18383
|
23
23
|
alembic/ddl/oracle.py,sha256=669YlkcZihlXFbnXhH2krdrvDry8q5pcUGfoqkg_R6Y,6243
|
24
24
|
alembic/ddl/postgresql.py,sha256=S7uye2NDSHLwV3w8SJ2Q9DLbcvQIxQfJ3EEK6JqyNag,29950
|
25
25
|
alembic/ddl/sqlite.py,sha256=u5tJgRUiY6bzVltl_NWlI6cy23v8XNagk_9gPI6Lnns,8006
|
@@ -33,7 +33,7 @@ alembic/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
alembic/runtime/environment.py,sha256=L6bDW1dvw8L4zwxlTG8KnT0xcCgLXxUfdRpzqlJoFjo,41479
|
34
34
|
alembic/runtime/migration.py,sha256=lu9_z_qyWmNzSM52_FgdXP_G52PTmTTeOeMBQAkQTFg,49997
|
35
35
|
alembic/script/__init__.py,sha256=lSj06O391Iy5avWAiq8SPs6N8RBgxkSPjP8wpXcNDGg,100
|
36
|
-
alembic/script/base.py,sha256=
|
36
|
+
alembic/script/base.py,sha256=4jINClsNNwQIvnf4Kwp9JPAMrANLXdLItylXmcMqAkI,36896
|
37
37
|
alembic/script/revision.py,sha256=BQcJoMCIXtSJRLCvdasgLOtCx9O7A8wsSym1FsqLW4s,62307
|
38
38
|
alembic/script/write_hooks.py,sha256=uQWAtguSCrxU_k9d87NX19y6EzyjJRRQ5HS9cyPnK9o,5092
|
39
39
|
alembic/templates/async/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
|
@@ -58,7 +58,7 @@ alembic/templates/pyproject_async/alembic.ini.mako,sha256=bQnEoydnLOUgg9vNbTOys4
|
|
58
58
|
alembic/templates/pyproject_async/env.py,sha256=zbOCf3Y7w2lg92hxSwmG1MM_7y56i_oRH4AKp0pQBYo,2389
|
59
59
|
alembic/templates/pyproject_async/pyproject.toml.mako,sha256=Gf16ZR9OMG9zDlFO5PVQlfiL1DTKwSA--sTNzK7Lba0,2852
|
60
60
|
alembic/templates/pyproject_async/script.py.mako,sha256=04kgeBtNMa4cCnG8CfQcKt6P6rnloIfj8wy0u_DBydM,704
|
61
|
-
alembic/testing/__init__.py,sha256=
|
61
|
+
alembic/testing/__init__.py,sha256=PTMhi_2PZ1T_3atQS2CIr0V4YRZzx_doKI-DxKdQS44,1297
|
62
62
|
alembic/testing/assertions.py,sha256=qcqf3tRAUe-A12NzuK_yxlksuX9OZKRC5E8pKIdBnPg,5302
|
63
63
|
alembic/testing/env.py,sha256=pka7fjwOC8hYL6X0XE4oPkJpy_1WX01bL7iP7gpO_4I,11551
|
64
64
|
alembic/testing/fixtures.py,sha256=fOzsRF8SW6CWpAH0sZpUHcgsJjun9EHnp4k2S3Lq5eU,9920
|
@@ -85,9 +85,9 @@ alembic/util/langhelpers.py,sha256=LpOcovnhMnP45kTt8zNJ4BHpyQrlF40OL6yDXjqKtsE,1
|
|
85
85
|
alembic/util/messaging.py,sha256=3bEBoDy4EAXETXAvArlYjeMITXDTgPTu6ZoE3ytnzSw,3294
|
86
86
|
alembic/util/pyfiles.py,sha256=kOBjZEytRkBKsQl0LAj2sbKJMQazjwQ_5UeMKSIvVFo,4730
|
87
87
|
alembic/util/sqla_compat.py,sha256=9OYPTf-GCultAIuv1PoiaqYXAApZQxUOqjrOaeJDAik,14790
|
88
|
-
alembic-1.16.
|
89
|
-
alembic-1.16.
|
90
|
-
alembic-1.16.
|
91
|
-
alembic-1.16.
|
92
|
-
alembic-1.16.
|
93
|
-
alembic-1.16.
|
88
|
+
alembic-1.16.5.dist-info/licenses/LICENSE,sha256=NeqcNBmyYfrxvkSMT0fZJVKBv2s2tf_qVQUiJ9S6VN4,1059
|
89
|
+
alembic-1.16.5.dist-info/METADATA,sha256=_hKTp0jnKI77a2esxmoCXgv5t2U8hDZS7yZDRkDBl0k,7265
|
90
|
+
alembic-1.16.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
91
|
+
alembic-1.16.5.dist-info/entry_points.txt,sha256=aykM30soxwGN0pB7etLc1q0cHJbL9dy46RnK9VX4LLw,48
|
92
|
+
alembic-1.16.5.dist-info/top_level.txt,sha256=FwKWd5VsPFC8iQjpu1u9Cn-JnK3-V1RhUCmWqz1cl-s,8
|
93
|
+
alembic-1.16.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|