]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
4 years agoAdd cwd post-write hook option
Ben Mares [Mon, 29 Mar 2021 20:44:36 +0000 (16:44 -0400)] 
Add cwd post-write hook option

Fixes #822

Implements a `.cwd` suboption for post-write hooks.

For example, one can do
```ini
[post_write_hooks]
hooks = pre-commit

pre-commit.type = console_scripts
pre-commit.entrypoint = pre-commit
pre-commit.options = run --files REVISION_SCRIPT_FILENAME
pre-commit.cwd = %(here)s
```

This feature is illustrated by the last line above.

### Description

* Improve the names of some variables recently created in #820 in order to make the code more readable.
* Add `cwd` as an option which is passed directly into `subprocess.run()`
* Add a brief description to the documentation, together with an example with `pre-commit`.
<!-- Describe your changes in detail -->

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

A new feature implementation

- [X] please include the issue number, and create an issue if none exists, which must
- [X] include a complete example of how the feature would look.
- [X] Please include: `Fixes: #<issue number>` in the commit message
- [x] **please include tests.**

**Help requested:** I can't think of any simple way to write a test. Does anyone have a suggestion???

Closes: #823
Pull-request: https://github.com/sqlalchemy/alembic/pull/823
Pull-request-sha: 9a694a7fdfc55160d1e124f6119a7a5677ce019a

Change-Id: Iacbb06d52acc362588cff2cdfec442393be8594a

4 years agoAdd REVISION_SCRIPT_FILENAME token for post_write_hooks options
Ben Mares [Sat, 27 Mar 2021 08:44:49 +0000 (04:44 -0400)] 
Add REVISION_SCRIPT_FILENAME token for post_write_hooks options

I include a token called `REVISION_SCRIPT_FILENAME` which can be used in the `options` setting of a post-write hook. This token is replaced by the filename of the revision script, allowing the filename to be passed to the post-write hook in a flexible manner. Thus I can do:

```ini
[post_write_hooks]
hooks = pre-commit
pre-commit.type = console_scripts
pre-commit.entrypoint = pre-commit
pre-commit.options = run --files REVISION_SCRIPT_FILENAME
```

Note that the existing behavior is to prepend `REVISION_SCRIPT_FILENAME` to the argument list. In order to preserve backwards compatibility, this is done when `REVISION_SCRIPT_FILENAME` is not present.

### Description
* Implement the `REVISION_SCRIPT_FILENAME` token.
* Switch from `str.split()` to `shlex.split()` for robust command line argument processing.
* Insert `REVISION_SCRIPT_FILENAME` in appropriate locations in the docs and templates.
* Properly document that `REVISION_SCRIPT_FILENAME` is prepended instead of appended to the argument list.
* Refactored existing "test of `black` as a post-write hook" in order to avoid code duplication.
* Add a test for `REVISION_SCRIPT_FILENAME` and shlex.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [X] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

Fixes issue #819

Closes: #820
Pull-request: https://github.com/sqlalchemy/alembic/pull/820
Pull-request-sha: 73dd0a4d60758a06551a0aff47b9723b0345d74a

Change-Id: Ibfc677d59086703872d7cfd5c2da32bd0220a25f

4 years agoVersion 1.5.9 placeholder
Mike Bayer [Tue, 23 Mar 2021 18:24:45 +0000 (14:24 -0400)] 
Version 1.5.9 placeholder

4 years ago- 1.5.8 rel_1_5_8
Mike Bayer [Tue, 23 Mar 2021 18:13:02 +0000 (14:13 -0400)] 
- 1.5.8

4 years agouse new URL api for password obfuscate
Mike Bayer [Tue, 23 Mar 2021 13:40:27 +0000 (09:40 -0400)] 
use new URL api for password obfuscate

Fixed regression caused by SQLAlchemy 1.4 where the "alembic current"
command would fail due to changes in the ``URL`` object.

Change-Id: Ic0023885188c75ace19035adcf4c11c7bd10a843
Fixes: #816
4 years agoVersion 1.5.8 placeholder
Mike Bayer [Thu, 11 Mar 2021 16:25:00 +0000 (11:25 -0500)] 
Version 1.5.8 placeholder

4 years ago- 1.5.7 rel_1_5_7
Mike Bayer [Thu, 11 Mar 2021 16:22:26 +0000 (11:22 -0500)] 
- 1.5.7

4 years agoenable extensions to use AutogenContext.run_name_filters
Oliver Rice [Fri, 5 Mar 2021 19:23:40 +0000 (14:23 -0500)] 
enable extensions to use AutogenContext.run_name_filters

Adjusted the recently added
:paramref:`.EnvironmentContext.configure.include_name` hook to accommodate
for additional object types such as "views" that don't have a parent table,
to support third party recipes and extensions. Pull request courtesy Oliver
Rice.

Fixes: #813
Closes: #814
Pull-request: https://github.com/sqlalchemy/alembic/pull/814
Pull-request-sha: 45dbc9c3baebd02c44cdcafc7ac73f00e87d8a86

Change-Id: I75f22b745bd847638b9fdff9c19c1f0091a6b470

4 years agoVersion 1.5.7 placeholder
Mike Bayer [Fri, 5 Mar 2021 15:07:59 +0000 (10:07 -0500)] 
Version 1.5.7 placeholder

4 years ago- 1.5.6 rel_1_5_6
Mike Bayer [Fri, 5 Mar 2021 14:59:54 +0000 (09:59 -0500)] 
- 1.5.6

4 years agoAdjust mssql accommodate existing_type and type
Mike Bayer [Thu, 4 Mar 2021 15:54:03 +0000 (10:54 -0500)] 
Adjust mssql accommodate existing_type and type

Fixed bug where the "existing_type" parameter, which the MSSQL dialect
requires in order to change the nullability of a column in the absence of
also changing the column type, would cause an ALTER COLUMN operation to
incorrectly render a second ALTER statement without the nullability if a
new type were also present, as the MSSQL-specific contract did not
anticipate all three of "nullability", "type_" and "existing_type" being
sent at the same time.

Change-Id: Ia95b6c3e9276cc067fd773928f9678ab429d5670
Fixes: #812
4 years agoremove unnecessary whitespace changes made by GitHub 809/head
James Lamb [Mon, 1 Mar 2021 23:56:02 +0000 (17:56 -0600)] 
remove unnecessary whitespace changes made by GitHub

4 years ago[doc] clarify ALTER language in batch docs
James Lamb [Mon, 1 Mar 2021 23:02:09 +0000 (17:02 -0600)] 
[doc] clarify ALTER language in batch docs

4 years agoAdd async template to Alembic
CaselIT [Fri, 26 Feb 2021 20:21:52 +0000 (21:21 +0100)] 
Add async template to Alembic

Add async template to Alembic to bootstrap environments that use
async DBAPI. Updated the cookbook to include a migration guide
on how to adapt an existing enviroment for use with DBAPI drivers.

Fixes: #805
Change-Id: I5281b95ce8d48a31591902116c746ef9ae3fd7af

4 years ago[docs] fix versionchanged directive in autogenerate docs 798/head
James Lamb [Mon, 22 Feb 2021 05:35:52 +0000 (23:35 -0600)] 
[docs] fix versionchanged directive in autogenerate docs

4 years agoVersion 1.5.6 placeholder
Mike Bayer [Sat, 20 Feb 2021 21:48:55 +0000 (16:48 -0500)] 
Version 1.5.6 placeholder

4 years ago- 1.5.5 rel_1_5_5
Mike Bayer [Sat, 20 Feb 2021 21:47:00 +0000 (16:47 -0500)] 
- 1.5.5

4 years agoMerge "Implement sys_path_prepend option"
mike bayer [Sat, 20 Feb 2021 21:46:06 +0000 (21:46 +0000)] 
Merge "Implement sys_path_prepend option"

4 years agoImplement sys_path_prepend option
Mike Bayer [Sat, 20 Feb 2021 20:48:58 +0000 (15:48 -0500)] 
Implement sys_path_prepend option

Added new config file option ``prepend_sys_path``, which is a series of
paths that will be prepended to sys.path; the default value in newly
generated alembic.ini files is ".".  This fixes a long-standing issue
where for some reason running the alembic command line would not place the
local "." path in sys.path, meaning an application locally present in "."
and importable through normal channels, e.g. python interpreter, pytest,
etc. would not be located by Alembic, even though the ``env.py`` file is
loaded relative to the current path when ``alembic.ini`` contains a
relative path.

Change-Id: If8f4279bd862acca44d46f4b1ab90b0a18098af3
Fixes: #797
4 years agoadd versions for pre-commit tools
Mike Bayer [Sat, 20 Feb 2021 20:53:44 +0000 (15:53 -0500)] 
add versions for pre-commit tools

latest pre-commit is warning for use of "master" so apply version
numbers

Change-Id: I1375ef87a6d0b67e0fb0caeb03743d0dcd1af5ea

4 years agoUse SQLAlchemy _copy() when available
Mike Bayer [Thu, 18 Feb 2021 20:31:42 +0000 (15:31 -0500)] 
Use SQLAlchemy _copy() when available

Adjusted the use of SQLAlchemy's ".copy()" internals to use "._copy()"
for version 1.4.0, as this method is being renamed.

Change-Id: I1e69a1628e408f06b43efbc0cc52fc0ad1e8cbc4

4 years agoMerge remote-tracking branch 'github/pr/731'
Mike Bayer [Mon, 8 Feb 2021 16:14:45 +0000 (11:14 -0500)] 
Merge remote-tracking branch 'github/pr/731'

Change-Id: I66800d081f8da1160410357408d3e7ffa96f0aa3

4 years agoUpdate cookbook.rst references to #753 791/head
Andrew Fitzgerald [Sat, 6 Feb 2021 02:45:20 +0000 (21:45 -0500)] 
Update cookbook.rst references to #753

A fix for #753 was merged in November 2020 and released in 1.5.0 in January 2021.
This updates the references to #753 in cookbook.rst to note that a fix for #753 has been released.

4 years agoVersion 1.5.5 placeholder
Mike Bayer [Wed, 3 Feb 2021 15:03:47 +0000 (10:03 -0500)] 
Version 1.5.5 placeholder

4 years ago- 1.5.4 rel_1_5_4
Mike Bayer [Wed, 3 Feb 2021 15:01:34 +0000 (10:01 -0500)] 
- 1.5.4

4 years agoAdjust for immediate dependencies that are still ancestors
Mike Bayer [Tue, 2 Feb 2021 05:18:48 +0000 (00:18 -0500)] 
Adjust for immediate dependencies that are still ancestors

Fixed bug in versioning model where a downgrade across a revision with a
dependency on another branch, yet an ancestor is also dependent on that
branch, would produce an erroneous state in the alembic_version table,
making upgrades impossible without manually repairing the table.

Change-Id: Ic755f8c3f78845bb80f4f5b3d172caf77cb51132
Fixes: #789
4 years agoVersion 1.5.4 placeholder
Mike Bayer [Fri, 29 Jan 2021 21:54:36 +0000 (16:54 -0500)] 
Version 1.5.4 placeholder

4 years ago- 1.5.3 rel_1_5_3
Mike Bayer [Fri, 29 Jan 2021 21:51:30 +0000 (16:51 -0500)] 
- 1.5.3

4 years agoRemove obsolete SQLAlchemy pk issue workaround
Mike Bayer [Fri, 29 Jan 2021 01:10:33 +0000 (20:10 -0500)] 
Remove obsolete SQLAlchemy pk issue workaround

Fixed issue where autogenerate rendering of ``op.alter_column()`` would
fail to include MySQL ``existing_nullable=False`` if the column were part
of a primary key constraint within the table metadata.

Change-Id: I6f3473b66c0faee035a438a25dcbe3a6f24eb041
Fixes: #788
4 years agoEnable SQL Server testing and fix autogen issues
Mike Bayer [Wed, 27 Jan 2021 19:01:40 +0000 (14:01 -0500)] 
Enable SQL Server testing and fix autogen issues

Fixed assorted autogenerate issues with SQL Server:

* ignore default reflected identity on primary_key columns
* improve server default comparison

Updated test_autogen_fks for modern levels of FK
capabilities

Change-Id: I94b815cedf90422ccd5ceceb765b07d772b505b7
Fixes: #787
4 years agoPlace index/uq drops before creates
Mike Bayer [Wed, 27 Jan 2021 17:28:37 +0000 (12:28 -0500)] 
Place index/uq drops before creates

Changed the default ordering of "CREATE" and "DROP" statements indexes and
unique constraints within the autogenerate process, so that for example in
an upgrade() operation, a particular index or constraint that is to be
replaced such as for a casing convention change will not produce any naming
conflicts. For foreign key constraint objects, this is already how
constraints are ordered, and for table objects, users would normally want
to use :meth:`.Operations.rename_table` in any case.

Change-Id: I1b20e8ce6e1ea080df5c1738bf2e7ae91c0c40ad
Fixes: #786
4 years agotemporarily block mssql
Mike Bayer [Wed, 27 Jan 2021 20:48:16 +0000 (15:48 -0500)] 
temporarily block mssql

We've enabled mssql on jenkins which is failing
right now.  Disable it from tox directly so builds
can run until we get it fixed.

Also see if we can switch to using SQLAlchemy
extras_require here.

Change-Id: If644ecccb08e72da525ab40370141d2d20de093b

4 years agoVersion 1.5.3 placeholder
Mike Bayer [Wed, 20 Jan 2021 18:34:19 +0000 (13:34 -0500)] 
Version 1.5.3 placeholder

4 years ago- 1.5.2 rel_1_5_2
Mike Bayer [Wed, 20 Jan 2021 18:30:40 +0000 (13:30 -0500)] 
- 1.5.2

4 years agoensure downrev/dependencies in tuple form before using "in"
Mike Bayer [Wed, 20 Jan 2021 16:40:52 +0000 (11:40 -0500)] 
ensure downrev/dependencies in tuple form before using "in"

Fixed regression where new "loop detection" feature introduced in
:ticket:`757` produced false positives for revision names that have
overlapping substrings between revision number and down revision and/or
dependency, if the downrev/dependency were not in sequence form.

Fixes: #784
Change-Id: I9f31298c91ee2d3c1c63fd1f52bf8e0309b6ad88

4 years agoFix workflow test window fail
CaselIT [Tue, 19 Jan 2021 20:43:32 +0000 (15:43 -0500)] 
Fix workflow test window fail

Need to disable asyncio before calling into pytest session start or windows will fails randomly.

Closes: #783
Pull-request: https://github.com/sqlalchemy/alembic/pull/783
Pull-request-sha: c92f7a2c0460899c942fcc668cbffe672b59df01

Change-Id: I9026334db651aa977fbc809494f449e38ca16a6f

4 years agoretrieve 1.3 transaction from branched connection properly
Mike Bayer [Tue, 19 Jan 2021 19:26:46 +0000 (14:26 -0500)] 
retrieve 1.3 transaction from branched connection properly

Fixed regression where Alembic would fail to create a transaction properly
if the :class:`sqlalchemy.engine.Connection` were a so-called "branched"
connection, that is, one where the ``.connect()`` method had been called to
create a "sub" connection.

Change-Id: I5319838a08686ede7dc873ce5d39428b1afdf6ff
Fixes: #782
4 years agoVersion 1.5.2 placeholder
Mike Bayer [Tue, 19 Jan 2021 15:21:52 +0000 (10:21 -0500)] 
Version 1.5.2 placeholder

4 years ago- 1.5.1 rel_1_5_1
Mike Bayer [Tue, 19 Jan 2021 15:19:02 +0000 (10:19 -0500)] 
- 1.5.1

4 years agofix typo
Mike Bayer [Tue, 19 Jan 2021 15:18:26 +0000 (10:18 -0500)] 
fix typo

Change-Id: Ieb504598707487c11ba51458a4e505b749ad711e

4 years agofix erroneous package_dir directive
Mike Bayer [Tue, 19 Jan 2021 14:55:06 +0000 (09:55 -0500)] 
fix erroneous package_dir directive

Fixed installation issue where the "templates" directory was not being
installed, preventing commands like "list-templates" and "init" from
working.

Change-Id: Ic47cee2dbb3c4c81a34e91557a3275ef68a22b74
Fixes: #780
4 years agoVersion 1.5.1 placeholder
Mike Bayer [Mon, 18 Jan 2021 20:59:38 +0000 (15:59 -0500)] 
Version 1.5.1 placeholder

4 years ago- 1.5.0 rel_1_5_0
Mike Bayer [Mon, 18 Jan 2021 20:52:24 +0000 (15:52 -0500)] 
- 1.5.0

4 years agoremove all .. version(?:changed|added):: prior to 1.0
Mike Bayer [Mon, 18 Jan 2021 20:27:01 +0000 (15:27 -0500)] 
remove all .. version(?:changed|added):: prior to 1.0

Change-Id: I2a1a0c273adc871b12e13d7f913609fe1122dab3

4 years agoimplement include_name hook
Mike Bayer [Mon, 18 Jan 2021 17:27:38 +0000 (12:27 -0500)] 
implement include_name hook

Added new hook :paramref:`.EnvironmentContext.configure.include_name`,
which complements the
:paramref:`.EnvironmentContext.configure.include_object` hook by providing
a means of preventing objects of a certain name from being autogenerated
**before** the SQLAlchemy reflection process takes place, and notably
includes explicit support for passing each schema name when
:paramref:`.EnvironmentContext.configure.include_schemas` is set to True.
This is most important especially for enviroments that make use of
:paramref:`.EnvironmentContext.configure.include_schemas` where schemas are
actually databases (e.g. MySQL) in order to prevent reflection sweeps of
the entire server.

The long deprecated
:paramref:`.EnvironmentContext.configure.include_symbol` hook is removed.
The  :paramref:`.EnvironmentContext.configure.include_object`
and  :paramref:`.EnvironmentContext.configure.include_name`
hooks both achieve the goals of this hook.

Change-Id: Idd44a357088a79be94488fdd7a7841bf118d47e2
Fixes: #650
4 years agoRemove remaining 2.0 warning
Mike Bayer [Fri, 15 Jan 2021 18:44:53 +0000 (13:44 -0500)] 
Remove remaining 2.0 warning

with the merge of If6b792e57c8c5dff205419644ab68e631575a2fa
in SQLAlchemy we can remove this last 2.0 deprecation warning
filter.

Change-Id: I2a615dc70432e9b6a89a551f405c2a81bcbb8981

4 years agoMerge "Support default nullable on identity columns."
mike bayer [Fri, 15 Jan 2021 16:46:05 +0000 (16:46 +0000)] 
Merge "Support default nullable on identity columns."

4 years agoSupport default nullable on identity columns.
CaselIT [Sat, 9 Jan 2021 10:57:46 +0000 (11:57 +0100)] 
Support default nullable on identity columns.

This fixes the test for I0516d506ff327cff35cda605e8897a27440e0373

Change-Id: Ief4546fcb7d4d266d0f1f73ed53069dc5cb34fde

4 years agodocumentation fixes
Mike Bayer [Fri, 15 Jan 2021 15:23:36 +0000 (10:23 -0500)] 
documentation fixes

Change-Id: I1f2e8376ce86886a9b35fa48cb7a78ca1735095c

4 years agodisable SQLA 1.4 asyncio mode
Mike Bayer [Tue, 12 Jan 2021 21:33:31 +0000 (16:33 -0500)] 
disable SQLA 1.4 asyncio mode

The latest merge that uses SQLAlchemy's test suite
more fully is not functioning with the asyncio wrappers.
As we don't need those here right now, disable them.

Change-Id: Iafccb38386ab548614d6dd7a500356a635396289

4 years agoMerge "Accommodate SQLAlchemy 1.4/2.0"
mike bayer [Tue, 12 Jan 2021 15:50:33 +0000 (15:50 +0000)] 
Merge "Accommodate SQLAlchemy 1.4/2.0"

4 years agoAccommodate SQLAlchemy 1.4/2.0
CaselIT [Mon, 19 Oct 2020 21:23:08 +0000 (23:23 +0200)] 
Accommodate SQLAlchemy 1.4/2.0

To accommodate SQLAlchemy 1.4 and 2.0, the migration model now no longer
assumes that the SQLAlchemy Connection will autocommit an individual
operation.   This essentially means that for databases that use
non-transactional DDL (pysqlite current driver behavior, MySQL), there is
still a BEGIN/COMMIT block that will surround each individual migration.
Databases that support transactional DDL should continue to have the
same flow, either per migration or per-entire run, depending on the
value of the :paramref:`.Environment.configure.transaction_per_migration`
flag.

Compatibility is established such that the entire library should
not generate any SQLAlchemy 2.0 deprecation warnings and
SQLALCHEMY_WARN_20 is part of conftest.py. (one warning remains
for the moment that needs to be resolved on the SQLAlchemy side)

The test suite requires SQLAlchemy 1.4.0b2 for testing 1.4;
1.4.0b1 won't work.

Test suite / setup also being modernized, as we are at
SQLAlchemy 1.3 we can now remove the majority of the testing
suite plugin.

Change-Id: If55b1ea3c12ead66405ab3fadc76d15d89dabb90

4 years agoPin PyMySQL < 1.0.0 for python 2
Mike Bayer [Thu, 7 Jan 2021 19:09:09 +0000 (14:09 -0500)] 
Pin PyMySQL < 1.0.0 for python 2

Change-Id: I4b5533463acb858c76739e56d94c0e642035cee4

4 years agohappy new year
Mike Bayer [Mon, 4 Jan 2021 14:42:23 +0000 (09:42 -0500)] 
happy new year

Change-Id: Ib2dc683401cd48d00b357bb735ce4b7a540d0ed2

4 years agoConsult ApplyBatchImpl for hints on constraints to drop
Mike Bayer [Sun, 27 Dec 2020 21:40:48 +0000 (16:40 -0500)] 
Consult ApplyBatchImpl for hints on constraints to drop

Made an adjustment to the PostgreSQL dialect to allow it to work more
effectively in batch mode, where a datatype like Boolean or non-native Enum
that may have embedded rules to generate CHECK constraints will be more
correctly handled in that these constraints usually will not have been
generated on the PostgreSQL backend; previously it would inadvertently
assume they existed unconditionally in a special PG-only "drop constraint"
step.

Change-Id: I024b07bee6eec92061d902cbe1b086cb5b3ecd7c
Fixes: #773
4 years agouse private alembic name for fixture metadata
Mike Bayer [Mon, 21 Dec 2020 20:04:32 +0000 (15:04 -0500)] 
use private alembic name for fixture metadata

assigning self.metadata conflicts with fixtures in
SQLAlchemy inlcuding a class level method we hope to add.

Change-Id: Ifebb654268f5e4a13643adf79acb2e7c3df08b05

4 years agoMerge "Add support identity columns."
mike bayer [Thu, 17 Dec 2020 19:33:58 +0000 (19:33 +0000)] 
Merge "Add support identity columns."

4 years agoUse exclusions from sqlalchemy
CaselIT [Tue, 15 Dec 2020 22:17:20 +0000 (23:17 +0100)] 
Use exclusions from sqlalchemy

Since alembic 1.5 will support only sqlalchemy 1.3+ it can
safely use the exclusions from sqlalchemy.

Enable test for computed columns with sqlite >= 3.31

Fixes: #759
Change-Id: If629e0c0aa264205fa571e26b3ba8398634c374d

4 years agoAdd support identity columns.
CaselIT [Tue, 17 Nov 2020 21:32:36 +0000 (22:32 +0100)] 
Add support identity columns.

Added support for rendering of "identity" elements on
:class:`.Column` objects, supported in SQLAlchemy via
the :class:`.Identity` element introduced in version 1.4.

Adding columns with identity is supported on PostgreSQL,
MSSQL and Oracle. Changing the identity options or removing
it is supported only on PostgreSQL and Oracle.

Fixes: #730
Change-Id: I184d8bd30ef5c6286f3263b4033ca4eb359c02e2

4 years agoRaise an exception if any loop or cycle found in a revision graph constructed.
Koichiro Den [Tue, 1 Dec 2020 02:53:33 +0000 (21:53 -0500)] 
Raise an exception if any loop or cycle found in a revision graph constructed.

The revision tree is now checked for cycles and loops between revision
files when the revision environment is loaded up.  Scenarios such as a
revision pointing to itself, or a revision that can reach itself via a
loop, are handled and will raise the :class:`.CycleDetected` exception when
the environment is loaded (expressed from the Alembic commandline as a
failure message and nonzero return code). Previously, these situations were
silently ignored up front, and the behavior of revision traversal would
either be silently incorrect, or would produce errors such as
:class:`.RangeNotAncestorError`.  Pull request courtesy Koichiro Den.

Fixes: #757
Closes: #758
Pull-request: https://github.com/sqlalchemy/alembic/pull/758
Pull-request-sha: a5c5a72c407b74e8b2ca9a1289a85617e154fcb9

Change-Id: I2199caf237870df943e5a8816e6f0beb80a5950a

4 years agoMerge "Add more missing mariadb directives"
mike bayer [Sat, 28 Nov 2020 03:04:14 +0000 (03:04 +0000)] 
Merge "Add more missing mariadb directives"

4 years agoAdd more missing mariadb directives
Mike Bayer [Fri, 27 Nov 2020 17:52:05 +0000 (12:52 -0500)] 
Add more missing mariadb directives

Continuing from 985422d42f0670c4019cd3d208aa
I6e17f65842bda0aaf6e67437d12078318311eb60 , more mariadb idenifiers
needed.

Change-Id: Ie1d4067064d445253ab1c6ae9e066eef33e13c4c

4 years agoImplement column comments for batch
Mike Bayer [Fri, 27 Nov 2020 17:48:53 +0000 (12:48 -0500)] 
Implement column comments for batch

Added missing "create comment" feature for columns that are altered in
batch migrations.

Change-Id: I7468937702cefc8f581e27b1c4ba670e4f8b7d17
Fixes: #761
4 years agoMerge "Copy column that's already attached"
mike bayer [Thu, 5 Nov 2020 14:44:19 +0000 (14:44 +0000)] 
Merge "Copy column that's already attached"

4 years agoMerge "Added detection of Table prefixes in the create table render"
mike bayer [Thu, 5 Nov 2020 14:39:16 +0000 (14:39 +0000)] 
Merge "Added detection of Table prefixes in the create table render"

4 years agoAdd cookbook recipe illustrating autogenerate->invoke directly
Mike Bayer [Thu, 5 Nov 2020 14:05:42 +0000 (09:05 -0500)] 
Add cookbook recipe illustrating autogenerate->invoke directly

Change-Id: I46c0436971f50c0969f70ecf99c191533db65dcf

4 years agoAdded detection of Table prefixes in the create table render
rmoretto [Sat, 5 Sep 2020 16:30:45 +0000 (12:30 -0400)] 
Added detection of Table prefixes in the create table render

Added rendering for the ``Table.prefixes`` element to autogenerate so that
the rendered Python code includes these directives. Pull request courtesy
Rodrigo Ce Moretto.

Fixes: #721
Closes: #734
Pull-request: https://github.com/sqlalchemy/alembic/pull/734
Pull-request-sha: 4917e195c184b79d63ea60a31ae8ea59e499162c

Change-Id: I1e53500d49784c3ce2672fa9ce82876fa7645ee9

4 years agoCopy column that's already attached
Mike Bayer [Thu, 5 Nov 2020 13:22:18 +0000 (08:22 -0500)] 
Copy column that's already attached

Modified the ``add_column()`` operation such that the ``Column`` object in
use is shallow copied to a new instance if that ``Column`` is already
attached to a ``table()`` or ``Table``. This accommodates for the change
made in SQLAlchemy issue #5618 which prohibits a ``Column`` from being
associated with multiple ``table()`` objects. This resumes support for
using a ``Column`` inside of an Alembic operation that already refers to a
parent ``table()`` or ``Table`` as well as allows operation objects just
autogenerated to work.

Change-Id: Idc6933cf0da40373f4f270d75883995822c072f0
Fixes: #753
4 years agoAdd ``__main__.py`` file to alembic package
CaselIT [Sun, 18 Oct 2020 17:42:33 +0000 (19:42 +0200)] 
Add ``__main__.py`` file to alembic package

Also reformat the changelog a bit

Fixes: #728
Change-Id: I9198bd9f9fc5d8723a8ddca9faad8835b514fcc0

4 years agoRemoved of old deprecated code:
CaselIT [Tue, 27 Oct 2020 20:55:48 +0000 (21:55 +0100)] 
Removed of old deprecated code:

  * ``--head_only`` option to the ``alembic current`` command
  * legacy argument names in operations, deprecated since version 0.8

Change-Id: Ib6e265e3c2820971d446a1568de16e4a6efb18eb

4 years agoMerge "Update black to 20.8b1"
mike bayer [Tue, 27 Oct 2020 13:08:49 +0000 (13:08 +0000)] 
Merge "Update black to 20.8b1"

4 years agoAdd github test workflows
CaselIT [Mon, 26 Oct 2020 19:51:07 +0000 (20:51 +0100)] 
Add github test workflows

Change-Id: Ic76936a6fa3617410ad6419a106fdbb0f320a77a

4 years agoUpdate black to 20.8b1
CaselIT [Mon, 26 Oct 2020 19:39:37 +0000 (20:39 +0100)] 
Update black to 20.8b1

Change-Id: Id9b8ce6a0ccd2a6fa17b779c95d4079a5fa629d7

4 years agoRemove support for Python 3.5 and SQLAlchemy older than the 1.3 series.
CaselIT [Fri, 16 Oct 2020 19:39:41 +0000 (21:39 +0200)] 
Remove support for Python 3.5 and SQLAlchemy older than the 1.3 series.

Fixes: #748
Change-Id: I18df97bdce5de6adb222d3f16486272e95b1b1a6

4 years agoAdd interim recipe for multi-tenant
Mike Bayer [Tue, 29 Sep 2020 16:55:41 +0000 (12:55 -0400)] 
Add interim recipe for multi-tenant

Alembic does not have a multi-tenant story right now.
for the schema use case, search_path represents the best
way to make it happen at a rudimental level.  Document
the basic idea for this as it is known to work for the moment.

Change-Id: I14f8eebc285f67bc374eb829e5fce49dc5820c9c
References: #555

4 years agoSupport pytest 6.x
Mike Bayer [Sun, 27 Sep 2020 01:05:53 +0000 (21:05 -0400)] 
Support pytest 6.x

pytest has removed support for pytest.Class(..parent)
and we need to use from_parent.

Also works around new issue for 6.1.0

References: https://github.com/pytest-dev/pytest/issues/7807

Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4

4 years agoVersion 1.4.4 placeholder
Mike Bayer [Fri, 11 Sep 2020 15:02:37 +0000 (11:02 -0400)] 
Version 1.4.4 placeholder

4 years ago- 1.4.3 rel_1_4_3
Mike Bayer [Fri, 11 Sep 2020 14:50:57 +0000 (10:50 -0400)] 
- 1.4.3

4 years agoUse regular renderer for MySQL server default
Mike Bayer [Fri, 11 Sep 2020 13:56:14 +0000 (09:56 -0400)] 
Use regular renderer for MySQL server default

Fixed issue where the MySQL dialect would not correctly render the server
default of a column in an alter operation, if the operation were
programmatically generated from an autogenerate pass as it would not
accommodate for the full structure of the DefaultClause construct.

Change-Id: I2701b396067e80c75bacbb596e24bb1e75454d10
Fixes: #736
4 years agoFix column existence check in batch operation
CaselIT [Fri, 4 Sep 2020 19:18:27 +0000 (21:18 +0200)] 
Fix column existence check in batch operation

Existence of a column check used ``ColumnCollection.contains_column`` with a
the name of the column instead of the column instance.

Change-Id: I41d9f6b6ed9e44eeb9ced78b039da6261491eeee

4 years agoFix typo. 731/head
Karthikeyan Singaravelan [Wed, 26 Aug 2020 11:56:51 +0000 (11:56 +0000)] 
Fix typo.

4 years agoCheck for URL.create()
Mike Bayer [Sun, 23 Aug 2020 14:44:44 +0000 (10:44 -0400)] 
Check for URL.create()

in the possibly upcoming I28a0a471d80792fa8c28f4fa573d6352966a4a79
we will want to use URL.create(); establish compat.

Change-Id: I397aae93ffdd34205b57a27e75f3801fcf459db7

4 years agocontinue adding mariadb placeholder impl
Mike Bayer [Sat, 15 Aug 2020 18:07:44 +0000 (14:07 -0400)] 
continue adding mariadb placeholder impl

the change in 14b6b24c3e3950a6255333b3a01f47a819040ea0 was nearly
pointless by itself as I forgot to add "mariadb" to compiles
rules and requirements.

Change-Id: I6e17f65842bda0aaf6e67437d12078318311eb60

4 years agoadd MariaDB placeholder impl
Mike Bayer [Fri, 14 Aug 2020 23:28:19 +0000 (19:28 -0400)] 
add MariaDB placeholder impl

in 599f27dcce62abac1f90a44f9c9a85e7dca885de we updated the
checks for "mariadb" to match SQLAlchemy 1.4.  Another
change if merged will add a new dialect name "mariadb" that's
basically the mysql dialect with a different name; forwards-support
that as well.

Change-Id: I6ba1c13304fa8d6f45dd6453f4c71d04021163ae

4 years agoupdate mariadb checks
Mike Bayer [Fri, 14 Aug 2020 20:19:58 +0000 (16:19 -0400)] 
update mariadb checks

We want to revise mariadb version info stuff in
SQLAlchemy master so use _is_mariadb and
_mariadb_normalized_version_info
both of which are as far back as rel_1_1 at least

Change-Id: I7040a8a65a81762c11b4033cfed6b015cc97999c

5 years agoRemove typo in _exec_drop_col_fk_constraint
Oleg Shigorin [Fri, 24 Jul 2020 13:18:18 +0000 (09:18 -0400)] 
Remove typo in _exec_drop_col_fk_constraint

Fixed issue where the ``mssql_drop_foreign_key=True`` flag on
``op.drop_column`` would lead to incorrect syntax error due to a typo in the
SQL emitted, same typo was present in the test as well so it was not
detected. Pull request courtesy Oleg Shigorin.

Fixes: #716
Closes: #717
Pull-request: https://github.com/sqlalchemy/alembic/pull/717
Pull-request-sha: dcd90fb4dfe8acd63670aedbdee58be25d4781d2

Change-Id: I022a66a3bcebf689945cfbd36bed0ebed248364f

5 years agoSupport DROP of named check constraint from column for batch
Mike Bayer [Thu, 16 Jul 2020 01:23:31 +0000 (21:23 -0400)] 
Support DROP of named check constraint from column for batch

Added support to drop named CHECK constraints that are specified as part of
a column, rather than table wide.  Previously, only constraints associated
with the table were considered.

Change-Id: Id1765357e0fa59745b41ba233b18a53e38358e0b
Fixes: #711
5 years agorevise bracket cx_Oracle for python 2 / 3
Mike Bayer [Thu, 16 Jul 2020 19:00:33 +0000 (15:00 -0400)] 
revise bracket cx_Oracle for python 2 / 3

Change-Id: I9011dbc32a1ba677ecc659a8fdfc8606819fdf56

5 years agoPin cx_oracle for python 2
Mike Bayer [Fri, 26 Jun 2020 23:40:06 +0000 (19:40 -0400)] 
Pin cx_oracle for python 2

cx_Oracle 8 is out and it's python 3 only.
get tox.ini to use cx_oracle 7 for python 2 tests.

Change-Id: If57cb699f447653b1cb8ddd912a50c9180be08ac

5 years agoAdd an additional create_constraint
Mike Bayer [Wed, 3 Jun 2020 18:08:12 +0000 (14:08 -0400)] 
Add an additional create_constraint

missing from Ic823124446607c2f245663350632382bd1ca10ba

Change-Id: Ib9962f1440b6295a64997cf0d09c787fc2624279

5 years agoSet create_constraint=True for Enum / Boolean tests
Mike Bayer [Tue, 2 Jun 2020 23:37:25 +0000 (19:37 -0400)] 
Set create_constraint=True for Enum / Boolean tests

In SQLAlchemy [1] [2] we are changing the default
for Enum / Boolean create_constraint to False.  ensure
tests that rely upon this setting being True set
it explicitly.

[1] I0a3fb608ce32143fa757546cc17ba2013e93272a
[2] https://github.com/sqlalchemy/sqlalchemy/issues/5367

Change-Id: Ic823124446607c2f245663350632382bd1ca10ba

5 years agoDo not CAST(x as JSON) in SQLite
Sebastián Ramírez [Mon, 1 Jun 2020 13:38:12 +0000 (09:38 -0400)] 
Do not CAST(x as JSON) in SQLite

Fixed issue where the CAST applied to a JSON column when copying a SQLite
table during batch mode would cause the data to be lost, as SQLite's CAST
with JSON appears to convert the data to the value "0". The CAST is now
skipped in a dialect-specific manner, including for JSON columns on SQLite.
Pull request courtesy Sebastián Ramírez.

Fixes: #697
Closes: #698
Pull-request: https://github.com/sqlalchemy/alembic/pull/698
Pull-request-sha: 6618325258bd90ec257b09c17d44421a5642b1b1

Change-Id: Ia152ea7386e64efb2194aa836dc57754f979e204

5 years agoadd posargs to pep8
Mike Bayer [Fri, 29 May 2020 20:49:01 +0000 (16:49 -0400)] 
add posargs to pep8

we want to be able to specify --output-file

Change-Id: I0a23431be6cbfd16514693183cda1a6c09ba98cc

5 years agoEnsure "alembic current" won't unnecessarily mutate the database
Nikolay Edigaryev [Fri, 15 May 2020 21:18:47 +0000 (17:18 -0400)] 
Ensure "alembic current" won't unnecessarily mutate the database

The ``alembic current`` command no longer creates an ``alembic_version``
table in the database if one does not exist already, returning no version
as the current version. This allows checking for migrations in parallel
without introducing race conditions.  Pull request courtesy Nikolay
Edigaryev.

Fixes: #694
Closes: #695
Pull-request: https://github.com/sqlalchemy/alembic/pull/695
Pull-request-sha: fd3e3b8faf7a41dd4c35daca6c7d224e983ab496

Change-Id: I500ab9ec1fe74b5e20e6aecfe598bce7e9cdef96

5 years agoAdd members to operations, batch
Mike Bayer [Tue, 5 May 2020 14:16:51 +0000 (10:16 -0400)] 
Add members to operations, batch

for some reason these did not have :members: and for some
reason it used to work anyway.

Change-Id: I2ead3dd7ffe5d313693dfca6e8b312f4e39ac743
Fixes: #689
5 years agoMerge remote-tracking branch 'origin/pr/688' into master-gerrit
CaselIT [Tue, 28 Apr 2020 17:02:22 +0000 (19:02 +0200)] 
Merge remote-tracking branch 'origin/pr/688' into master-gerrit

5 years agoImprove issue templates 688/head
CaselIT [Tue, 28 Apr 2020 16:52:39 +0000 (18:52 +0200)] 
Improve issue templates

Change-Id: I29f6d1e4a5d4a46659e56f1af20aa3d0ab033daa

5 years agoAdd link to Alembic Utils as an example of replaceable objects.
Mike Bayer [Mon, 27 Apr 2020 23:02:57 +0000 (19:02 -0400)] 
Add link to Alembic Utils as an example of replaceable objects.

Change-Id: I9f8f423a363970814d2ca5fea2c0b2c35c34d19d
References: #686

5 years agoadd issue templates
CaselIT [Mon, 27 Apr 2020 19:03:52 +0000 (21:03 +0200)] 
add issue templates

Change-Id: Ia4ad98ffe4c648a2556bde163ccc364e27f35873

5 years agoTypo fix: appopriate -> appropriate. 687/head
Danny Hermes [Mon, 27 Apr 2020 17:45:45 +0000 (10:45 -0700)] 
Typo fix: appopriate -> appropriate.