existing_comment=None,
schema=None,
):
- """Invokes the `:func:`alembic.operations.toimpl.create_table_comment`
- impl to initiate a new COMMENT ON `table` operation.
+ """Emit a COMMENT ON operation to set the comment for a table.
+
+ .. versionadded:: 1.0.6
:param table_name: string name of the target table.
:param comment: string value of the comment being registered against
the specified table.
- :param existing_comment: An optional string value of a comment
- already registered
- on the specified table.
+ :param existing_comment: String value of a comment
+ already registered on the specified table, used within autogenerate
+ so that the operation is reversible, but not required for direct
+ use.
+
+ .. seealso::
+
+ :meth:`.Operations.drop_table_comment`
+
+ :paramref:`.Operations.alter_column.comment`
"""
@Operations.register_operation("drop_table_comment")
class DropTableCommentOp(AlterTableOp):
- """Represent a COMMENT ON `table` operation.
+ """Represent an operation to remove the comment from a table.
"""
def __init__(self, table_name, schema=None, existing_comment=None):
def drop_table_comment(
cls, operations, table_name, existing_comment=None, schema=None
):
- """Invokes the `:func:`alembic.operations.toimpl.drop_table_comment` to
+ """Issue a "drop table comment" operation to
remove an existing comment set on a table.
+ .. versionadded:: 1.0.6
+
:param table_name: string name of the target table.
:param existing_comment: An optional string value of a comment already
- registered
- on the specified table.
+ registered on the specified table.
+
+ .. seealso::
+
+ :meth:`.Operations.create_table_comment`
+
+ :paramref:`.Operations.alter_column.comment`
"""
or :class:`~sqlalchemy.schema.DefaultClause` to indicate
an alteration to the column's default value.
Set to ``None`` to have the default removed.
+ :param comment: optional string text of a new comment to add to the
+ column.
+
+ .. versionadded:: 1.0.6
+
:param new_column_name: Optional; specify a string name here to
indicate the new name within a column rename operation.
:param type_: Optional; a :class:`~sqlalchemy.types.TypeEngine`
:param existing_autoincrement: Optional; the existing autoincrement
of the column. Used for MySQL's system of altering a column
that specifies ``AUTO_INCREMENT``.
+ :param existing_comment: string text of the existing comment on the
+ column to be maintained. Required on MySQL if the existing comment
+ on the column is not being changed.
+
+ .. versionadded:: 1.0.6
+
:param schema: Optional schema name to operate within. To control
quoting of the schema outside of the default behavior, use
the SQLAlchemy construct
)
@property
- def sqlalchemy_1216(self):
+ def sqlalchemy_issue_4436(self):
+ def check(config):
+ vers = sqla_compat._vers
+
+ if vers == (1, 3, 0, 'b1'):
+ return True
+ elif vers > (1, 2, 16):
+ return False
+ else:
+ return True
+
return exclusions.skip_if(
- lambda config: not util.sqla_1216,
- "SQLAlchemy 1.2.16 or greater required",
+ check,
+ "SQLAlchemy 1.2.16, 1.3.0b2 or greater required",
)
@property
:tickets: 422
Added Table and Column level comments for supported backends.
- `create_table`, `add_column` and `alter_column` now all optionally
- take `comment="X"` kwarg. Support for autogenerate for Table
- and Column objects has also been added.
\ No newline at end of file
+ New methods :meth:`.Operations.create_table_comment` and
+ :meth:`.Operations.drop_table_comment` are added. A new arguments
+ :paramref:`.Operations.alter_column.comment` and
+ :paramref:`.Operations.alter_column.existing_comment` are added to
+ :meth:`.Operations.alter_column`. Autogenerate support is also added
+ to ensure comment add/drops from tables and columns are generated as well
+ as that :meth:`.Operations.create_table`, :meth:`.Operations.add_column`
+ both include the comment field from the source :class:`.Table`
+ or :class:`.Column` object.
\ No newline at end of file