]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Fixes: #1348 Typings for target_metadata sequence of metadatas
authorIuri de Silvio <iuri.desilvio@channable.com>
Wed, 8 Nov 2023 19:06:28 +0000 (14:06 -0500)
committersqla-tester <sqla-tester@sqlalchemy.org>
Wed, 8 Nov 2023 19:06:28 +0000 (14:06 -0500)
<!-- Provide a general summary of your proposed changes in the Title field above -->

Ref #1348

Add `Sequence[MetaData]` typing to `target_metadata` args.

### Description
<!-- Describe your changes in detail -->

### Checklist
<!-- 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:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] 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: #1349
Pull-request: https://github.com/sqlalchemy/alembic/pull/1349
Pull-request-sha: 5fcdaf5a6075303b8fb14646f3b93e4c2f76a772

Change-Id: Idd341a69aa024be1f6374fc0faa6b2519ff222bd

alembic/context.pyi
alembic/runtime/environment.py

index f37f246183428423380c421537cfee811f596354..aef1745555553e682660ed23af96229e54bd7835 100644 (file)
@@ -14,6 +14,7 @@ from typing import Mapping
 from typing import MutableMapping
 from typing import Optional
 from typing import overload
+from typing import Sequence
 from typing import TextIO
 from typing import Tuple
 from typing import TYPE_CHECKING
@@ -97,7 +98,7 @@ def configure(
     tag: Optional[str] = None,
     template_args: Optional[Dict[str, Any]] = None,
     render_as_batch: bool = False,
-    target_metadata: Optional[MetaData] = None,
+    target_metadata: Union[MetaData, Sequence[MetaData], None] = None,
     include_name: Optional[
         Callable[
             [
index 7640f563a99a399c952258ca71cfa6191c3a3e54..74672d7ac3b1a331a3b449431dcabecf7157cd7e 100644 (file)
@@ -10,6 +10,7 @@ from typing import Mapping
 from typing import MutableMapping
 from typing import Optional
 from typing import overload
+from typing import Sequence
 from typing import TextIO
 from typing import Tuple
 from typing import TYPE_CHECKING
@@ -416,7 +417,7 @@ class EnvironmentContext(util.ModuleClsProxy):
         tag: Optional[str] = None,
         template_args: Optional[Dict[str, Any]] = None,
         render_as_batch: bool = False,
-        target_metadata: Optional[MetaData] = None,
+        target_metadata: Union[MetaData, Sequence[MetaData], None] = None,
         include_name: Optional[IncludeNameFn] = None,
         include_object: Optional[IncludeObjectFn] = None,
         include_schemas: bool = False,