diff options
author | TilmanK <tilman.krummeck@googlemail.com> | 2021-09-14 15:39:59 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-09-17 09:26:59 -0400 |
commit | 4abcbcd56ae1a657334195a18c46bd6b3d5e444a (patch) | |
tree | 6a8b2406c7b46aac0780e470c772c0d762fb27f2 /alembic/operations | |
parent | a2a9e197ca41bc9f5f61ff22646485871348e8da (diff) | |
download | alembic-4abcbcd56ae1a657334195a18c46bd6b3d5e444a.tar.gz |
Fix constraint_name type of create_foreign_key
Fixed type annotations for the "constraint_name" argument of operations
``create_primary_key()``, ``create_foreign_key()``. Pull request courtesy
TilmanK.
Closes: #914
Pull-request: https://github.com/sqlalchemy/alembic/pull/914
Pull-request-sha: 39d44af226b2103da3964daf3229880a0958b97c
Change-Id: Iec4b392c70ae0eeda06dcbfda95a2f044e976686
Diffstat (limited to 'alembic/operations')
-rw-r--r-- | alembic/operations/ops.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py index d5ddbc9..7d69f09 100644 --- a/alembic/operations/ops.py +++ b/alembic/operations/ops.py @@ -296,7 +296,7 @@ class CreatePrimaryKeyOp(AddConstraintOp): def create_primary_key( cls, operations: "Operations", - constraint_name: str, + constraint_name: Optional[str], table_name: str, columns: List[str], schema: Optional[str] = None, @@ -321,9 +321,9 @@ class CreatePrimaryKeyOp(AddConstraintOp): off normally. The :class:`~sqlalchemy.schema.AddConstraint` construct is ultimately used to generate the ALTER statement. - :param name: Name of the primary key constraint. The name is necessary - so that an ALTER statement can be emitted. For setups that - use an automated naming scheme such as that described at + :param constraint_name: Name of the primary key constraint. The name + is necessary so that an ALTER statement can be emitted. For setups + that use an automated naming scheme such as that described at :ref:`sqla:constraint_naming_conventions` ``name`` here can be ``None``, as the event listener will apply the name to the constraint object when it is associated @@ -588,7 +588,7 @@ class CreateForeignKeyOp(AddConstraintOp): def create_foreign_key( cls, operations: "Operations", - constraint_name: str, + constraint_name: Optional[str], source_table: str, referent_table: str, local_cols: List[str], @@ -621,9 +621,9 @@ class CreateForeignKeyOp(AddConstraintOp): off normally. The :class:`~sqlalchemy.schema.AddConstraint` construct is ultimately used to generate the ALTER statement. - :param name: Name of the foreign key constraint. The name is necessary - so that an ALTER statement can be emitted. For setups that - use an automated naming scheme such as that described at + :param constraint_name: Name of the foreign key constraint. The name + is necessary so that an ALTER statement can be emitted. For setups + that use an automated naming scheme such as that described at :ref:`sqla:constraint_naming_conventions`, ``name`` here can be ``None``, as the event listener will apply the name to the constraint object when it is associated @@ -2389,7 +2389,7 @@ class ExecuteSQLOp(MigrateOperation): op.execute("INSERT INTO table (foo) VALUES ('\:colon_value')") - :param sql: Any legal SQLAlchemy expression, including: + :param sqltext: Any legal SQLAlchemy expression, including: * a string * a :func:`sqlalchemy.sql.expression.text` construct. |