summaryrefslogtreecommitdiff
path: root/alembic/operations
diff options
context:
space:
mode:
authorTilmanK <tilman.krummeck@googlemail.com>2021-09-14 15:39:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-09-17 09:26:59 -0400
commit4abcbcd56ae1a657334195a18c46bd6b3d5e444a (patch)
tree6a8b2406c7b46aac0780e470c772c0d762fb27f2 /alembic/operations
parenta2a9e197ca41bc9f5f61ff22646485871348e8da (diff)
downloadalembic-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.py18
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.