]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix type annotation of schema.MetaData.naming_convention 9598/head
authorhanbin <58972963+hanbin8269@users.noreply.github.com>
Wed, 5 Apr 2023 01:46:45 +0000 (10:46 +0900)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 01:46:45 +0000 (10:46 +0900)
According to the documentation, we should be able to use `Callable[Constraint, Table]]` as the value type for MetaData.naming_convention.

https://docs.sqlalchemy.org/en/20/core/metadata.html#sqlalchemy.schema.MetaData.params.naming_convention

lib/sqlalchemy/sql/schema.py

index b4263137b38182c770a47001a38284f645eec08b..078157820f0dd014d423bf4ef35573e09b442aa9 100644 (file)
@@ -5108,7 +5108,7 @@ class MetaData(HasSchemaAttr):
         self,
         schema: Optional[str] = None,
         quote_schema: Optional[bool] = None,
-        naming_convention: Optional[Dict[str, str]] = None,
+        naming_convention: Optional[Dict[str, str | Callable[Constraint, Table]]] = None,
         info: Optional[_InfoType] = None,
     ) -> None:
         """Create a new MetaData object.