alembic 1.16.4__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 +9 -3
- alembic/ddl/mysql.py +30 -1
- {alembic-1.16.4.dist-info → alembic-1.16.5.dist-info}/METADATA +1 -1
- {alembic-1.16.4.dist-info → alembic-1.16.5.dist-info}/RECORD +9 -9
- {alembic-1.16.4.dist-info → alembic-1.16.5.dist-info}/WHEEL +0 -0
- {alembic-1.16.4.dist-info → alembic-1.16.5.dist-info}/entry_points.txt +0 -0
- {alembic-1.16.4.dist-info → alembic-1.16.5.dist-info}/licenses/LICENSE +0 -0
- {alembic-1.16.4.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.
|
@@ -470,9 +472,11 @@ class Config:
|
|
470
472
|
|
471
473
|
def _get_toml_config_value(
|
472
474
|
self, name: str, default: Optional[Any] = None
|
473
|
-
) -> Union[
|
475
|
+
) -> Union[
|
476
|
+
None, str, list[str], dict[str, str], list[dict[str, str]], int
|
477
|
+
]:
|
474
478
|
USE_DEFAULT = object()
|
475
|
-
value: Union[None, str, list[str], dict[str, str]] = (
|
479
|
+
value: Union[None, str, list[str], dict[str, str], int] = (
|
476
480
|
self.toml_alembic_config.get(name, USE_DEFAULT)
|
477
481
|
)
|
478
482
|
if value is USE_DEFAULT:
|
@@ -495,6 +499,8 @@ class Config:
|
|
495
499
|
"dict[str, str]",
|
496
500
|
{k: v % (self.toml_args) for k, v in value.items()},
|
497
501
|
)
|
502
|
+
elif isinstance(value, int):
|
503
|
+
return value
|
498
504
|
else:
|
499
505
|
raise util.CommandError(
|
500
506
|
f"unsupported TOML value type for key: {name!r}"
|
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),
|
@@ -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
|
@@ -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
|