]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Fix typing of `partial_reordering`
authorDaniël <93520871+Flaab123@users.noreply.github.com>
Tue, 16 Dec 2025 13:27:05 +0000 (08:27 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 16 Dec 2025 14:14:21 +0000 (09:14 -0500)
<!-- Provide a general summary of your proposed changes in the Title field above -->
The typing of the `partial_reordering` argument of `batch_alter_table` is not correct.

<!-- Describe your changes in detail -->
As stated in the documentation and docstring, the `batch_alter_table()` function expects a list of tuples for the `partial_reordering` argument. The current typing suggests the user to insert a tuple containing Any into the argument, which doesn't align with the docstring.

<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ x] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #1764
Pull-request: https://github.com/sqlalchemy/alembic/pull/1764
Pull-request-sha: f0a0c1a913b93a2c71881e69be83a7888e21bc5e

Change-Id: I1f442df0674e85361234a97aed1d79f58d30214f

alembic/op.pyi
alembic/operations/base.py

index cb4953c1599d27122c9df156f9473fcfad514f9d..6da538713cb62479e8093e57f964c4a23df665cf 100644 (file)
@@ -256,7 +256,7 @@ def batch_alter_table(
     table_name: str,
     schema: Optional[str] = None,
     recreate: Literal["auto", "always", "never"] = "auto",
-    partial_reordering: Optional[Tuple[Any, ...]] = None,
+    partial_reordering: Optional[list[tuple[str, ...]]] = None,
     copy_from: Optional[Table] = None,
     table_args: Tuple[Any, ...] = (),
     table_kwargs: Mapping[str, Any] = immutabledict({}),
index bea7f9dc2c3fa86daa45f12a1e473f952396e502..5ca38b1f99c1851fadd8924fc3d7daaf6c5427d1 100644 (file)
@@ -248,7 +248,7 @@ class AbstractOperations(util.ModuleClsProxy):
         table_name: str,
         schema: Optional[str] = None,
         recreate: Literal["auto", "always", "never"] = "auto",
-        partial_reordering: Optional[Tuple[Any, ...]] = None,
+        partial_reordering: Optional[list[tuple[str, ...]]] = None,
         copy_from: Optional[Table] = None,
         table_args: Tuple[Any, ...] = (),
         table_kwargs: Mapping[str, Any] = util.immutabledict(),