From 2eb96e3102beb9046c730af8bd69a21c93d0858a Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Sat, 12 Aug 2023 21:40:45 +0200 Subject: [PATCH] Remove old version notes, prior to version 1.7 This also removes some old docs regarding sqlalchemy version prior to version 1 Change-Id: If983df98c07d4a0a6492c151b407b735b74780dc --- alembic/command.py | 8 -------- alembic/context.pyi | 5 ----- alembic/ddl/impl.py | 2 -- alembic/op.pyi | 12 ------------ alembic/operations/base.py | 20 ------------------- alembic/operations/ops.py | 18 ----------------- alembic/runtime/environment.py | 5 ----- alembic/runtime/migration.py | 2 -- alembic/script/write_hooks.py | 2 -- docs/build/autogenerate.rst | 19 ------------------ docs/build/batch.rst | 36 ++++------------------------------ docs/build/cookbook.rst | 16 +-------------- docs/build/front.rst | 4 ---- docs/build/tutorial.rst | 1 - 14 files changed, 5 insertions(+), 145 deletions(-) diff --git a/alembic/command.py b/alembic/command.py index f5e1ee06..94c939f7 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -54,9 +54,6 @@ def init( :param package: when True, write ``__init__.py`` files into the environment location as well as the versions/ location. - .. versionadded:: 1.2 - - """ if os.access(directory, os.F_OK) and os.listdir(directory): @@ -625,9 +622,6 @@ def stamp( .. note:: this parameter is called "revisions" in the command line interface. - .. versionchanged:: 1.2 The revision may be a single revision or - list of revisions when stamping multiple branch heads. - :param sql: use ``--sql`` mode :param tag: an arbitrary "tag" that can be intercepted by custom @@ -636,8 +630,6 @@ def stamp( :param purge: delete all entries in the version table before stamping. - .. versionadded:: 1.2 - """ script = ScriptDirectory.from_config(config) diff --git a/alembic/context.pyi b/alembic/context.pyi index eedf7afd..265d723c 100644 --- a/alembic/context.pyi +++ b/alembic/context.pyi @@ -226,9 +226,6 @@ def configure( ``connection`` and ``url`` are not passed. :param dialect_opts: dictionary of options to be passed to dialect constructor. - - .. versionadded:: 1.0.12 - :param transactional_ddl: Force the usage of "transactional" DDL on or off; this otherwise defaults to whether or not the dialect in @@ -400,8 +397,6 @@ def configure( include_name = include_name ) - .. versionadded:: 1.5 - .. seealso:: :ref:`autogenerate_include_hooks` diff --git a/alembic/ddl/impl.py b/alembic/ddl/impl.py index 21371f1a..38827092 100644 --- a/alembic/ddl/impl.py +++ b/alembic/ddl/impl.py @@ -571,8 +571,6 @@ class DefaultImpl(metaclass=ImplMeta): """Render a SQL expression that is typically a server default, index expression, etc. - .. versionadded:: 1.0.11 - """ compile_kw = { diff --git a/alembic/op.pyi b/alembic/op.pyi index dd470310..6e143e47 100644 --- a/alembic/op.pyi +++ b/alembic/op.pyi @@ -181,9 +181,6 @@ def alter_column( 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` @@ -217,9 +214,6 @@ def alter_column( :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 @@ -374,8 +368,6 @@ def batch_alter_table( set is undefined. Therefore it is best to specify the complete ordering of all columns for best results. - .. versionadded:: 1.4.0 - .. note:: batch mode requires SQLAlchemy 0.8 or above. .. seealso:: @@ -827,8 +819,6 @@ def create_table_comment( ) -> None: """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. @@ -1021,8 +1011,6 @@ def drop_table_comment( """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. diff --git a/alembic/operations/base.py b/alembic/operations/base.py index 4f33bd04..8df6efd1 100644 --- a/alembic/operations/base.py +++ b/alembic/operations/base.py @@ -350,8 +350,6 @@ class AbstractOperations(util.ModuleClsProxy): set is undefined. Therefore it is best to specify the complete ordering of all columns for best results. - .. versionadded:: 1.4.0 - .. note:: batch mode requires SQLAlchemy 0.8 or above. .. seealso:: @@ -709,9 +707,6 @@ class Operations(AbstractOperations): 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` @@ -745,9 +740,6 @@ class Operations(AbstractOperations): :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 @@ -1223,8 +1215,6 @@ class Operations(AbstractOperations): ) -> None: """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. @@ -1428,8 +1418,6 @@ class Operations(AbstractOperations): """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. @@ -1629,8 +1617,6 @@ class BatchOperations(AbstractOperations): :param insert_before: String name of an existing column which this column should be placed before, when creating the new table. - .. versionadded:: 1.4.0 - :param insert_after: String name of an existing column which this column should be placed after, when creating the new table. If both :paramref:`.BatchOperations.alter_column.insert_before` @@ -1638,8 +1624,6 @@ class BatchOperations(AbstractOperations): omitted, the column is inserted after the last existing column in the table. - .. versionadded:: 1.4.0 - .. seealso:: :meth:`.Operations.alter_column` @@ -1759,8 +1743,6 @@ class BatchOperations(AbstractOperations): """Emit a COMMENT ON operation to set the comment for a table using the current batch migration context. - .. versionadded:: 1.6.0 - :param comment: string value of the comment being registered against the specified table. :param existing_comment: String value of a comment @@ -1832,8 +1814,6 @@ class BatchOperations(AbstractOperations): remove an existing comment set on a table using the current batch operations context. - .. versionadded:: 1.6.0 - :param existing_comment: An optional string value of a comment already registered on the specified table. diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py index dcf7b6b0..4066ac7e 100644 --- a/alembic/operations/ops.py +++ b/alembic/operations/ops.py @@ -1482,8 +1482,6 @@ class CreateTableCommentOp(AlterTableOp): ) -> None: """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. @@ -1519,8 +1517,6 @@ class CreateTableCommentOp(AlterTableOp): """Emit a COMMENT ON operation to set the comment for a table using the current batch migration context. - .. versionadded:: 1.6.0 - :param comment: string value of the comment being registered against the specified table. :param existing_comment: String value of a comment @@ -1595,8 +1591,6 @@ class DropTableCommentOp(AlterTableOp): """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. @@ -1623,8 +1617,6 @@ class DropTableCommentOp(AlterTableOp): remove an existing comment set on a table using the current batch operations context. - .. versionadded:: 1.6.0 - :param existing_comment: An optional string value of a comment already registered on the specified table. @@ -1873,9 +1865,6 @@ class AlterColumnOp(AlterTableOp): 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` @@ -1909,9 +1898,6 @@ class AlterColumnOp(AlterTableOp): :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 @@ -1972,8 +1958,6 @@ class AlterColumnOp(AlterTableOp): :param insert_before: String name of an existing column which this column should be placed before, when creating the new table. - .. versionadded:: 1.4.0 - :param insert_after: String name of an existing column which this column should be placed after, when creating the new table. If both :paramref:`.BatchOperations.alter_column.insert_before` @@ -1981,8 +1965,6 @@ class AlterColumnOp(AlterTableOp): omitted, the column is inserted after the last existing column in the table. - .. versionadded:: 1.4.0 - .. seealso:: :meth:`.Operations.alter_column` diff --git a/alembic/runtime/environment.py b/alembic/runtime/environment.py index e5dfa59e..7efa0f02 100644 --- a/alembic/runtime/environment.py +++ b/alembic/runtime/environment.py @@ -466,9 +466,6 @@ class EnvironmentContext(util.ModuleClsProxy): ``connection`` and ``url`` are not passed. :param dialect_opts: dictionary of options to be passed to dialect constructor. - - .. versionadded:: 1.0.12 - :param transactional_ddl: Force the usage of "transactional" DDL on or off; this otherwise defaults to whether or not the dialect in @@ -640,8 +637,6 @@ class EnvironmentContext(util.ModuleClsProxy): include_name = include_name ) - .. versionadded:: 1.5 - .. seealso:: :ref:`autogenerate_include_hooks` diff --git a/alembic/runtime/migration.py b/alembic/runtime/migration.py index 2c10ad59..76742294 100644 --- a/alembic/runtime/migration.py +++ b/alembic/runtime/migration.py @@ -320,8 +320,6 @@ class MigrationContext: migrations whether or not one of them has an autocommit block. - .. versionadded:: 1.2.0 - """ _in_connection_transaction = self._in_connection_transaction() diff --git a/alembic/script/write_hooks.py b/alembic/script/write_hooks.py index 5f53dc20..6ca19115 100644 --- a/alembic/script/write_hooks.py +++ b/alembic/script/write_hooks.py @@ -25,8 +25,6 @@ def register(name: str) -> Callable: See the documentation linked below for an example. - .. versionadded:: 1.2.0 - .. seealso:: :ref:`post_write_hooks_custom` diff --git a/docs/build/autogenerate.rst b/docs/build/autogenerate.rst index 57144432..5f34c0a0 100644 --- a/docs/build/autogenerate.rst +++ b/docs/build/autogenerate.rst @@ -142,14 +142,6 @@ Autogenerate can **optionally detect**: The type comparison logic is fully extensible as well; see :ref:`compare_types` for details. - .. versionchanged:: 1.4 type comparison code has been reworked such that - column types are compared based on their rendered DDL, which should allow - the functionality enabled by - :paramref:`.EnvironmentContext.configure.compare_type` - to be much more accurate, correctly accounting for the behavior of - SQLAlchemy "generic" types as well as major arguments specified within - types. - * Change of server default. This will occur if you set the :paramref:`.EnvironmentContext.configure.compare_server_default` parameter to ``True``, or to a custom callable function. @@ -393,9 +385,6 @@ rules that include both :class:`~sqlalchemy.schema.MetaData` and reflected object, the :paramref:`.EnvironmentContext.configure.include_object` hook discussed in the next section is more appropriate. -.. versionadded:: 1.5 added the :paramref:`.EnvironmentContext.configure.include_name` - hook. - Omitting Based on Object ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -629,8 +618,6 @@ is set to True:: database backend sets as a default value without generating false positives. -.. versionchanged:: 1.4.0 Added the text and keyword comparison for column types - Alternatively, the :paramref:`.EnvironmentContext.configure.compare_type` parameter accepts a callable function which may be used to implement custom type comparison logic, for cases such as where special user defined types @@ -698,10 +685,6 @@ first; if it returns ``None``, then the ``compare_against_backend`` method will be used, if present on the metadata type. If that returns ``None``, then a basic check for type equivalence is run. -.. versionadded:: 1.4.0 - added column keyword comparisons and the - ``type_synonyms`` property. - - .. _post_write_hooks: Applying Post Processing and Python Code Formatters to Generated Revisions @@ -720,8 +703,6 @@ path to the newly generated file as well as configuration options. The post write hooks, when configured, run against generated revision files regardless of whether or not the autogenerate feature was used. -.. versionadded:: 1.2 - .. note:: Alembic's post write system is partially inspired by the `pre-commit diff --git a/docs/build/batch.rst b/docs/build/batch.rst index b1a1022e..a0ed6916 100644 --- a/docs/build/batch.rst +++ b/docs/build/batch.rst @@ -119,7 +119,7 @@ database that have no identifying name. On all other backends, the target database will always generate some kind of name, if one is not given. -The first challenge this represents is that an unnamed constraint can't +The challenge this represents is that an unnamed constraint can't by itself be targeted by the :meth:`.BatchOperations.drop_constraint` method. An unnamed FOREIGN KEY constraint is implicit whenever the :class:`~sqlalchemy.schema.ForeignKey` @@ -128,23 +128,15 @@ passing them a name. Only on SQLite will these constraints remain entirely unnamed when they are created on the target database; an automatically generated name will be assigned in the case of all other database backends. -A second issue is that SQLAlchemy itself has inconsistent behavior in -dealing with SQLite constraints as far as names. Prior to version 1.0, -SQLAlchemy omits the name of foreign key constraints when reflecting them -against the SQLite backend. So even if the target application has gone through -the steps to apply names to the constraints as stated in the database, -they still aren't targetable within the batch reflection process prior -to SQLAlchemy 1.0. - Within the scope of batch mode, this presents the issue that the :meth:`.BatchOperations.drop_constraint` method requires a constraint name in order to target the correct constraint. In order to overcome this, the :meth:`.Operations.batch_alter_table` method supports a :paramref:`~.Operations.batch_alter_table.naming_convention` argument, so that -all reflected constraints, including foreign keys that are unnamed, or -were named but SQLAlchemy isn't loading this name, may be given a name, -as described in :ref:`autogen_naming_conventions`. Usage is as follows:: +all reflected constraints, including foreign keys that are unnamed may be +given a name, as described in :ref:`autogen_naming_conventions`. +Usage is as follows:: naming_convention = { "fk": @@ -158,26 +150,6 @@ as described in :ref:`autogen_naming_conventions`. Usage is as follows:: Note that the naming convention feature requires at least **SQLAlchemy 0.9.4** for support. -Including unnamed UNIQUE constraints -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -A similar, but frustratingly slightly different, issue is that in the -case of UNIQUE constraints, we again have the issue that SQLite allows -unnamed UNIQUE constraints to exist on the database, however in this case, -SQLAlchemy prior to version 1.0 doesn't reflect these constraints at all. -It does properly reflect named unique constraints with their names, however. - -So in this case, the workaround for foreign key names is still not sufficient -prior to SQLAlchemy 1.0. If our table includes unnamed unique constraints, -and we'd like them to be re-created along with the table, we need to include -them directly, which can be via the -:paramref:`~.Operations.batch_alter_table.table_args` argument:: - - with self.op.batch_alter_table( - "bar", table_args=(UniqueConstraint('username'),) - ): - batch_op.add_column(Column('foo', Integer)) - .. _batch_schematype_constraints: Changing the Type of Boolean, Enum and other implicit CHECK datatypes diff --git a/docs/build/cookbook.rst b/docs/build/cookbook.rst index d05bd407..0b59de97 100644 --- a/docs/build/cookbook.rst +++ b/docs/build/cookbook.rst @@ -1319,24 +1319,16 @@ follows:: elem.table_name, schema=elem.schema ) as batch_ops: for table_elem in elem.ops: - # work around Alembic issue #753 (fixed in 1.5.0) - if hasattr(table_elem, "column"): - table_elem.column = table_elem.column.copy() batch_ops.invoke(table_elem) elif hasattr(elem, "ops"): stack.extend(elem.ops) else: - # work around Alembic issue #753 (fixed in 1.5.0) - if hasattr(elem, "column"): - elem.column = elem.column.copy() operations.invoke(elem) Above, we detect elements that have a collection of operations by looking for the ``.ops`` attribute. A check for :class:`.ModifyTableOps` allows -us to use a batch context if we are supporting that. Finally there's a -workaround for an Alembic issue that exists for SQLAlchemy 1.3.20 and greater -combined with Alembic older than 1.5. +us to use a batch context if we are supporting that. A full example follows. The overall setup here is copied from the example at :func:`.autogenerate.compare_metadata`:: @@ -1400,17 +1392,11 @@ at :func:`.autogenerate.compare_metadata`:: elem.table_name, schema=elem.schema ) as batch_ops: for table_elem in elem.ops: - # work around Alembic issue #753 (fixed in 1.5.0) - if hasattr(table_elem, "column"): - table_elem.column = table_elem.column.copy() batch_ops.invoke(table_elem) elif hasattr(elem, "ops"): stack.extend(elem.ops) else: - # work around Alembic issue #753 (fixed in 1.5.0) - if hasattr(elem, "column"): - elem.column = elem.column.copy() operations.invoke(elem) diff --git a/docs/build/front.rst b/docs/build/front.rst index 5ca73e5f..9ec8b7df 100644 --- a/docs/build/front.rst +++ b/docs/build/front.rst @@ -64,10 +64,6 @@ local path is also in ``sys.path``. This allows us to run the ``alembic`` command line tool from this directory without our project being "installed" in that environment. -.. versionchanged:: 1.5.5 Fixed a long-standing issue where the ``alembic`` - command-line tool would not preserve the default ``sys.path`` of ``.`` - by implementing ``prepend_sys_path`` option. - As a final step, the `virtualenv activate `_ tool can be used so that the ``alembic`` command is available without any path information, within the context of the current shell:: diff --git a/docs/build/tutorial.rst b/docs/build/tutorial.rst index 8823a91b..2974768d 100644 --- a/docs/build/tutorial.rst +++ b/docs/build/tutorial.rst @@ -137,7 +137,6 @@ The file generated with the "generic" configuration looks like:: # sys.path path, will be prepended to sys.path if present. # defaults to the current working directory. - # (new in 1.5.5) prepend_sys_path = . # timezone to use when rendering the date within the migration file -- 2.47.2