]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
fix(config): allow integer return type in TOML configuration methods
authorLuís Henrique Allebrandt Schunemann <44511825+luishenri@users.noreply.github.com>
Sat, 16 Aug 2025 00:16:15 +0000 (21:16 -0300)
committerLuís Henrique Allebrandt Schunemann <44511825+luishenri@users.noreply.github.com>
Sat, 16 Aug 2025 00:16:15 +0000 (21:16 -0300)
alembic/config.py

index b2720ea26d56da8444d574907dbcd65f938f1efe..2372f28efaf07c271e101195d47155a22e3c818e 100644 (file)
@@ -426,7 +426,7 @@ class Config:
 
     def get_alembic_option(
         self, name: str, default: Optional[str] = None
-    ) -> Union[None, str, list[str], dict[str, str], list[dict[str, str]]]:
+    ) -> Union[None, str, list[str], dict[str, str], list[dict[str, str]], int]:
         """Return an option from the "[alembic]" or "[tool.alembic]" section
         of the configparser-parsed .ini file (e.g. ``alembic.ini``) or
         toml-parsed ``pyproject.toml`` file.
@@ -470,9 +470,9 @@ class Config:
 
     def _get_toml_config_value(
         self, name: str, default: Optional[Any] = None
-    ) -> Union[None, str, list[str], dict[str, str], list[dict[str, str]]]:
+    ) -> Union[None, str, list[str], dict[str, str], list[dict[str, str]], int]:
         USE_DEFAULT = object()
-        value: Union[None, str, list[str], dict[str, str], int] = (
+        value: Union[None, str, list[str], dict[str, str], list[dict[str,str]], int] = (
             self.toml_alembic_config.get(name, USE_DEFAULT)
         )
         if value is USE_DEFAULT:
@@ -496,7 +496,7 @@ class Config:
                     {k: v % (self.toml_args) for k, v in value.items()},
                 )
             elif isinstance(value, int):
-                value = str(value)
+                return value
             else:
                 raise util.CommandError(
                     f"unsupported TOML value type for key: {name!r}"