]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
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 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.

5 years agoMerge "Add version to cli"
mike bayer [Mon, 20 Apr 2020 17:29:22 +0000 (17:29 +0000)] 
Merge "Add version to cli"

5 years agoFix typo in documentation 678/head
Federico Caselli [Tue, 7 Apr 2020 15:17:58 +0000 (17:17 +0200)] 
Fix typo in documentation

Fixes the wrong version in `table_kwargs`. See: https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations.Operations.batch_alter_table

5 years agoAdd version to cli
CaselIT [Mon, 6 Apr 2020 18:51:22 +0000 (20:51 +0200)] 
Add version to cli

Fixes: #677
Change-Id: Ic63204d7873bc15a3db1cc03629f122b4fa2cdd0

5 years agoEnsure default_schema_name set to None in "schema is none" test
Mike Bayer [Tue, 24 Mar 2020 17:15:59 +0000 (13:15 -0400)] 
Ensure default_schema_name set to None in "schema is none" test

A test here is working with the assumption that the default
schema name for the SQLite dialect is None.  This assumption
is likely changing in SQLAlchemy 1.4 due to
Ia5c89eb27cc8dc2c5b8e76d6c07c46290a7901b6, so for this test
case explicitly set it to None.

Change-Id: I8b6427d9f975d489f33f51484e45b0bdc81acf70

5 years agoRemove pyproject.toml from distribution
Mike Bayer [Sat, 21 Mar 2020 14:21:41 +0000 (10:21 -0400)] 
Remove pyproject.toml from distribution

Alembic does not want to opt-in to pep-517 at this time.
As the standard is not widely adopted at this time in any case.  Per
[1] [2], the presence of this file indicates a positive opt-in
to pep-517, so it must be omitted from source distributions.

[1] https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
[2] https://www.python.org/dev/peps/pep-0517/#id5

Change-Id: I47121c3a0e29c5538cb0ee65b45f7fb1442c7da3
Fixes: #672
5 years agoCorrect issue number for issue 671
Mike Bayer [Thu, 19 Mar 2020 22:21:54 +0000 (18:21 -0400)] 
Correct issue number for issue 671

the patch in 52ef05c936170109f2f457751f4940e4269595c3  erroneously
mentioned #617 as the target issue, when it was supposed to be #671.

Change-Id: I2a327d1dc9173e62c7d65a35e65db7ec5edcf3e9
Fixes: #671
5 years agoVersion 1.4.3 placeholder
Mike Bayer [Thu, 19 Mar 2020 21:52:25 +0000 (17:52 -0400)] 
Version 1.4.3 placeholder

5 years ago- 1.4.2 rel_1_4_2
Mike Bayer [Thu, 19 Mar 2020 21:48:15 +0000 (17:48 -0400)] 
- 1.4.2

5 years agoMerge "Use looser tokenization for type comparison"
mike bayer [Thu, 19 Mar 2020 21:46:56 +0000 (21:46 +0000)] 
Merge "Use looser tokenization for type comparison"

5 years agouse text() in test_bulk_inserts
Mike Bayer [Thu, 19 Mar 2020 19:30:46 +0000 (15:30 -0400)] 
use text() in test_bulk_inserts

continuing from I4f6b83366329aa95204522c9e99129021d1899fc
for some reason test_bulk_inserts wasn't checked.

Change-Id: Icc3dc941556b0428623b18800cf42c6a200728e4

5 years agoUse looser tokenization for type comparison
Mike Bayer [Thu, 19 Mar 2020 16:32:47 +0000 (12:32 -0400)] 
Use looser tokenization for type comparison

Fixed more false-positive failures produced by the new "compare type" logic
first added in :ticket:`605`, particularly impacting MySQL string types
regarding flags such as "charset" and "collation".

Change-Id: If3dcfed7b0aa2d7367e1508289a0b5ee6f4c15a7
Fixes: #617
5 years agoDon't include schema in "to" portion of Oracle RENAME table
Mike Bayer [Thu, 19 Mar 2020 17:15:48 +0000 (13:15 -0400)] 
Don't include schema in "to" portion of Oracle RENAME table

Fixed issue in Oracle backend where a table RENAME with a schema-qualified
name would include the schema in the "to" portion, which is rejected by
Oracle.

Change-Id: I8110a58bea20ebe48bfca0877da6bd8e0abd17c2
Fixes: #670
5 years agoSupport sqlalchemy 1.4 exec_driver_sql, text() for strings
CaselIT [Tue, 17 Mar 2020 22:03:32 +0000 (23:03 +0100)] 
Support sqlalchemy 1.4 exec_driver_sql, text() for strings

Adjusted tests so that only connection-explicit execution
is used, along with the use of text() for string invocation.
Tests that are testing explicitly for deprecation warnings
will bypass SQLAlchemy warnings.   Added the RemovedIn20 warning
as an error raise for these two specific deprecation cases.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I4f6b83366329aa95204522c9e99129021d1899fc

5 years agoupdate README to refer to SQLAlchemy project standards
jonathan vanasco [Fri, 6 Mar 2020 15:24:17 +0000 (10:24 -0500)] 
update README to refer to SQLAlchemy project standards

* updated README to showcase code-of-conduct and development links

Closes: #645
Pull-request: https://github.com/sqlalchemy/alembic/pull/645
Pull-request-sha: a3584c5d7e21d4d64c989981a80f28d404579542

Change-Id: Ie14b1826ba79724821731bb0be46b7ab9c6627b5

5 years agoUpdate black to match sqlalchemy version
CaselIT [Tue, 17 Mar 2020 22:17:33 +0000 (23:17 +0100)] 
Update black to match sqlalchemy version

Also add a in the pep8 tox job a check to verify that all files
are properly formatted

Change-Id: I7bac8463b273f3bce9be098e6ee76f1761e28e72

5 years agoSupport computed reflection.
Mike Bayer [Tue, 17 Mar 2020 14:27:40 +0000 (10:27 -0400)] 
Support computed reflection.

Adjusted autogen comparison to accommodate for backends that support
computed column reflection, dependent on SQLAlchemy version 1.3.16 or
higher. This emits a warning if the SQL expression inside of a
:class:`.Computed` value changes between the metadata and the database, as
these expressions can't be changed without dropping and recreating the
column.

Change-Id: I6cf177865d074fcbfea032ce8b4d1aee82d7d098
Fixes: #669
5 years agoDon't raise on pytest deprecation warnings
Mike Bayer [Thu, 12 Mar 2020 23:59:34 +0000 (19:59 -0400)] 
Don't raise on pytest deprecation warnings

py.test 5.4.0 emits deprecation warnings for pytest.Class.
make sure we don't raise for these, and log the code that will
be used for 5.4.0 when we bump requirements.

Fixes: #668
Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328

5 years agoblack updates
Mike Bayer [Thu, 12 Mar 2020 00:53:11 +0000 (20:53 -0400)] 
black updates

Change-Id: Ifa214c490216bb6634945962681eb316c9e9e44f

5 years agoRemove trailing slashes in pre-commit config
Mike Bayer [Thu, 12 Mar 2020 00:50:36 +0000 (20:50 -0400)] 
Remove trailing slashes in pre-commit config

See https://github.com/sqlalchemy/dogpile.cache/pull/176

Change-Id: Id9a75546d4d0eae93ad837a77c6ffa9249efff5c

5 years agoVendor assert_raises[_message], add new check constraint target
Mike Bayer [Thu, 5 Mar 2020 17:13:46 +0000 (12:13 -0500)] 
Vendor assert_raises[_message], add new check constraint target

SQLAlchemy in 1.3 / master is now checking that re-thrown exceptions
have a cause, which we haven't implemented for Alembic yet.
If we did implement this for Alembic, we'd still need to
vendor these two anyway to test.   See
https://github.com/sqlalchemy/sqlalchemy/issues/4849

Also add "table_or_column_check_constraint" target so that
builds can pass, this was added for 1.4 / master
in
https://github.com/sqlalchemy/sqlalchemy/commit/ca2e4f385802799c2584782a8528e19a9e5513bc

Change-Id: I07fb2a380f027c44f6bb36e9499da2e8ae2223e7

5 years agoAdd custom table column sorting example
Mike Bayer [Tue, 3 Mar 2020 15:12:09 +0000 (10:12 -0500)] 
Add custom table column sorting example

Change-Id: Ie953ba34ed8e6cbf90e3070494279174ebca5d1a

5 years agoVersion 1.4.2 placeholder
Mike Bayer [Mon, 2 Mar 2020 16:23:13 +0000 (11:23 -0500)] 
Version 1.4.2 placeholder

5 years ago- 1.4.1 rel_1_4_1
Mike Bayer [Sun, 1 Mar 2020 17:45:18 +0000 (12:45 -0500)] 
- 1.4.1

5 years agoRespects ResultProxy.supports_sane_rowcount()
Ke Zhu [Fri, 28 Feb 2020 21:00:57 +0000 (16:00 -0500)] 
Respects ResultProxy.supports_sane_rowcount()

The check for matched rowcount when the alembic_version table is updated or
deleted from is now conditional based on whether or not the dialect
supports the concept of "rowcount" for UPDATE or DELETE rows matched.  Some
third party dialects do not support this concept.  Pull request courtesy Ke
Zhu.

Closes: #667
Pull-request: https://github.com/sqlalchemy/alembic/pull/667
Pull-request-sha: a0d45ed0f5de582314faae2210eeec881670488e

Change-Id: I09c9b540d8e21a94728085270eb20ba2273cbdb1

5 years agoMerge remote-tracking branch 'github/pr/665'
Mike Bayer [Fri, 28 Feb 2020 15:10:44 +0000 (10:10 -0500)] 
Merge remote-tracking branch 'github/pr/665'

Change-Id: Ic1d3a0a50fa7bebcb51af7a6b83209dc5bbb6ab9

5 years agoMerge "Include post-parenthesis tokens when tokenizing type string"
mike bayer [Thu, 27 Feb 2020 20:50:32 +0000 (20:50 +0000)] 
Merge "Include post-parenthesis tokens when tokenizing type string"

5 years agoInclude post-parenthesis tokens when tokenizing type string
Paul Becotte [Mon, 24 Feb 2020 14:39:55 +0000 (09:39 -0500)] 
Include post-parenthesis tokens when tokenizing type string

Fixed regression caused by the new "type comparison" logic introduced in
1.4 as part of :ticket:`605` where comparisons of MySQL "unsigned integer"
datatypes would produce false positives, as the regular expression logic
was not correctly parsing the "unsigned" token when MySQL's default display
width would be returned by the database.  Pull request courtesy Paul
Becotte.

Fixes: #661
Closes: #662
Pull-request: https://github.com/sqlalchemy/alembic/pull/662
Pull-request-sha: 28f181247ac475069eb8cd3669331e689fc78792

Change-Id: Ie1ba69fe0b3c2084026a51b1f835b3aab66aba6a

5 years agoUpdate error messages for SQLite no constraint support
Martin Haaß [Sat, 16 Mar 2019 21:28:59 +0000 (17:28 -0400)] 
Update error messages for SQLite no constraint support

clarify that batch mode should be used.

Closes: #526
Pull-request: https://github.com/sqlalchemy/alembic/pull/526
Pull-request-sha: 5d89cf4e77e5568887f2c8926a589c55427dab12

Change-Id: I06e7d8062ae7d1c96ec21318adf8f946a025aef8

5 years agoRemove simple typos in autogenerate docs 665/head
Ashok Argent-Katwala [Tue, 25 Feb 2020 17:03:25 +0000 (12:03 -0500)] 
Remove simple typos in autogenerate docs

5 years agoClarified an error message on failure to find 'migrations' path.
Rowan Hart [Mon, 24 Feb 2020 14:56:07 +0000 (09:56 -0500)] 
Clarified an error message on failure to find 'migrations' path.

Error message for "path doesn't exist" when loading up script environment
now displays the absolute path.  Pull request courtesy Rowan Hart.

Fixes: #663
Closes: #664
Pull-request: https://github.com/sqlalchemy/alembic/pull/664
Pull-request-sha: 29ff74c2678ab73f6c5a646477c840f5cdded234

Change-Id: Ibaa8ad444560e481ba96e0c0e3ba31ec7c7c1385

5 years agoUse inspect(), not Inspector.from_engine()
Mike Bayer [Mon, 24 Feb 2020 18:59:11 +0000 (13:59 -0500)] 
Use inspect(), not Inspector.from_engine()

The latter is deprecated in SQLAlchemy master / 1.4.

also add maxfail 25 for py.test coverage

Change-Id: I673f5da025ecbc240b2c8944d5823866619b7cc7

5 years agoAdd missing util.raise_from_cause
Mike Bayer [Mon, 24 Feb 2020 14:25:41 +0000 (09:25 -0500)] 
Add missing util.raise_from_cause

the re-vendoring of exclusions.py done by Mike
in 3ea190f843c7f246f73f91a looks for this function in util;
add it to the exported names from alembic.util.

Change-Id: I314801709993e1327396f0799fd9eefc3858985e

5 years agoMerge "Vendor inspect.formatannotation"
mike bayer [Sat, 8 Feb 2020 00:06:05 +0000 (00:06 +0000)] 
Merge "Vendor inspect.formatannotation"

5 years agoVendor inspect.formatannotation
Mike Bayer [Fri, 7 Feb 2020 22:58:17 +0000 (17:58 -0500)] 
Vendor inspect.formatannotation

Vendored the ``inspect.formatannotation`` function inside of
``alembic.util.compat``, which is needed for the vendored version of
``inspect.formatargspec``.  The function is not documented in cPython and
is not guaranteed to be available in future Python versions.

Change-Id: Ia891131c0776f025cd12d359e03587819881eaee
Fixes: #657
5 years agoMerge "Repair de-quoting logic used for pre-1.4 SQLAlchemy versions"
mike bayer [Thu, 6 Feb 2020 19:00:38 +0000 (19:00 +0000)] 
Merge "Repair de-quoting logic used for pre-1.4 SQLAlchemy versions"

5 years agoMerge "Render inline constraints for add_column"
mike bayer [Thu, 6 Feb 2020 17:48:05 +0000 (17:48 +0000)] 
Merge "Render inline constraints for add_column"

5 years agoRepair de-quoting logic used for pre-1.4 SQLAlchemy versions
Mike Bayer [Thu, 6 Feb 2020 15:38:57 +0000 (10:38 -0500)] 
Repair de-quoting logic used for pre-1.4 SQLAlchemy versions

Fixed regression in 1.4.0 due to :ticket:`647` where unique constraint
comparison with mixed case constraint names while not using a naming
convention would produce false positives during autogenerate.

Change-Id: Ic3d60f7d44377cdb4937ac0bb2bc11d27d03b8bd
Fixes: #654
5 years agoRender inline constraints for add_column
Mike Bayer [Thu, 6 Feb 2020 15:56:17 +0000 (10:56 -0500)] 
Render inline constraints for add_column

Fixed long-standing bug where an inline column CHECK constraint would not
be rendered within an "ADD COLUMN" operation.  The DDL compiler is now
consulted for inline constraints within the :meth:`.Operations.add_column`
method as is done for regular CREATE TABLE operations.

Change-Id: Ib176d13dd9151e65a1ca27357f7da0d4523f0b2f
Fixes: #655
5 years agoVersion 1.4.1 placeholder
Mike Bayer [Tue, 4 Feb 2020 21:04:58 +0000 (16:04 -0500)] 
Version 1.4.1 placeholder

5 years ago- 1.4.0 rel_1_4_0
Mike Bayer [Tue, 4 Feb 2020 21:02:25 +0000 (16:02 -0500)] 
- 1.4.0

5 years ago- next version will be 1.4.0
Mike Bayer [Tue, 4 Feb 2020 21:01:08 +0000 (16:01 -0500)] 
- next version will be 1.4.0

Change-Id: Ib2edb474a325588e1ea8ba5147704cae56be318e

5 years agoSupport explicit column ordering in batch mode
Marcin Szymanski [Fri, 31 Jan 2020 01:36:15 +0000 (20:36 -0500)] 
Support explicit column ordering in batch mode

Added new parameters :paramref:`.BatchOperations.add_column.insert_before`,
:paramref:`.BatchOperations.add_column.insert_after` which provide for
establishing the specific position in which a new column should be placed.
Also added :paramref:`.Operations.batch_alter_table.partial_reordering`
which allows the complete set of columns to be reordered when the new table
is created.   Both operations apply only to when batch mode is recreating
the whole table using ``recreate="always"``.  Thanks to Marcin Szymanski
for assistance with the implementation.

Co-Authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #640
Closes: #646
Pull-request: https://github.com/sqlalchemy/alembic/pull/646
Pull-request-sha: 29392b796dd995fabdabe50e8725385dbe1b4883

Change-Id: Iec9942baa08da4a7fc49b69093e84785fea3cec2

5 years agoUpdate the type comparison code used for schema autogeneration. Compare
Paul Becotte [Fri, 24 Jan 2020 00:36:33 +0000 (19:36 -0500)] 
Update the type comparison code used for schema autogeneration. Compare

A major rework of the "type comparison" logic is in place which changes the
entire approach by which column datatypes are compared.  Types are now
compared based on the DDL string generated by the metadata type vs. the
datatype reflected from the database.  This means we compare types based on
what would actually render and additionally if elements of the types change
like string length, those changes are detected as well.  False positives
like those generated between SQLAlchemy Boolean and MySQL TINYINT should
also be resolved.   Thanks very much to Paul Becotte  for lots of hard work
and patience on this one.

Fixes: #605
Closes: #619
Pull-request: https://github.com/sqlalchemy/alembic/pull/619
Pull-request-sha: 1a6a3860881081c3b98fdbfc203f8d3af5f98926

Change-Id: I1ab30f2a30fc567cde56b5b8be5f521ff235b67b

5 years agoMerge "Use inspect(), not Inspector.from_engine()"
mike bayer [Tue, 4 Feb 2020 17:51:37 +0000 (17:51 +0000)] 
Merge "Use inspect(), not Inspector.from_engine()"

5 years agoUse inspect(), not Inspector.from_engine()
Mike Bayer [Mon, 3 Feb 2020 17:20:10 +0000 (12:20 -0500)] 
Use inspect(), not Inspector.from_engine()

The internal inspection routines no longer use SQLAlchemy's
``Inspector.from_engine()`` method, which is expected to be deprecated in
1.4.  The ``inspect()`` function is now used.

Change-Id: I81ea16e5d750d8c48d8db1a5098815988ea60f6c

5 years agoMove use of ``__file__`` to be local to template access
layday [Mon, 3 Feb 2020 14:40:49 +0000 (09:40 -0500)] 
Move use of ``__file__`` to be local to template access

Moved the use of the ``__file__`` attribute at the base of the Alembic
package into the one place that it is specifically needed, which is when
the config attempts to locate the template directory. This helps to allow
Alembic to be fully importable in environments that are using Python
memory-only import schemes.  Pull request courtesy layday.

Partially-fixes: #648
Closes: #651
Pull-request: https://github.com/sqlalchemy/alembic/pull/651
Pull-request-sha: c30299dbc3499c59e81602d91deb3b03166b4583

Change-Id: I2607031d80c418ce4d7e779eeb42c57a53a72ce0

5 years agoAdjust unique constraint names based on dialect truncation rules
Mike Bayer [Thu, 30 Jan 2020 00:36:11 +0000 (19:36 -0500)] 
Adjust unique constraint names based on dialect truncation rules

Adjusted the unique constraint comparison logic in a similar manner as that
of :ticket:`421` did for indexes in order to take into account SQLAlchemy's
own truncation of long constraint names when a naming convention is in use.
Without this step, a name that is truncated by SQLAlchemy based on a unique
constraint naming convention or hardcoded name will not compare properly.

Also remove unused MySQL _legacy_correct_for_dupe_uq_uix which is no
longer used.

Change-Id: I6f709736b845727223c88951a11a899d7dc9b356
Fixes: #647
5 years agoVersion 1.3.4 placeholder
Mike Bayer [Wed, 22 Jan 2020 16:42:55 +0000 (11:42 -0500)] 
Version 1.3.4 placeholder

5 years ago- 1.3.3 rel_1_3_3
Mike Bayer [Wed, 22 Jan 2020 16:40:52 +0000 (11:40 -0500)] 
- 1.3.3

5 years agoAdd support for computed columns
CaselIT [Fri, 27 Dec 2019 22:26:38 +0000 (17:26 -0500)] 
Add support for computed columns

Added support for rendering of "computed" elements on :class:`.Column`
objects, supported in SQLAlchemy via the new :class:`.Computed` element
introduced in version 1.3.11. Pull request courtesy Federico Caselli.

Note that there is currently no support for ALTER COLUMN to add, remove, or
modify the "GENERATED ALWAYS AS" element from a column;  at least for
PostgreSQL, it does not seem to be supported by the database. Additionally,
SQLAlchemy does not currently reliably reflect the "GENERATED ALWAYS AS"
phrase from an existing column, so there is also no autogenerate support
for addition or removal of the :class:`.Computed` element to or from an
existing column, there is only support for adding new columns that include
the :class:`.Computed` element.  In the case that the :class:`.Computed`
element is removed from the :class:`.Column` object in the table metadata,
PostgreSQL and Oracle currently reflect the "GENERATED ALWAYS AS"
expression as the "server default" which will produce an op that tries to
drop the element as a default.

In order to facilitate using testing combinations with elements that
are not necessarily present, the support for lambda combinations
from SQLAlchemy Ia63a510f9c1d08b055eef62cf047f1f427f0450c is also
ported here, as well as a vendoring in of the current
sqlalchemy.testing.exclusions module where we need the additional
combinations support added in I15d2839954d77a252bab5aaf6e3fd9f388c99dd5.

Fixes: #624
Closes: #631
Pull-request: https://github.com/sqlalchemy/alembic/pull/631
Pull-request-sha: 9c45651295626edf5f172ec827a5ced1440818cf

Change-Id: Ifd27c2f541b22fb7a78de1afaa36dbf509ff6d3f

5 years agohappy new year
Mike Bayer [Wed, 1 Jan 2020 17:05:53 +0000 (12:05 -0500)] 
happy new year

Change-Id: I311bc286fe915db63eb12b23c8a726f9b6754473

5 years agoMerge "Source cleanups"
mike bayer [Wed, 1 Jan 2020 17:04:15 +0000 (17:04 +0000)] 
Merge "Source cleanups"

5 years agoSource cleanups
Mike Bayer [Wed, 1 Jan 2020 16:17:28 +0000 (11:17 -0500)] 
Source cleanups

- install flake8 to pre-commit hooks
- remove unused run_tests.py file
- ensure full pre-commit run succeeds

Change-Id: I31290078e48821ce9d78d45a74b51d0004047a1e

5 years agoFix tests on windows
CaselIT [Fri, 27 Dec 2019 17:06:39 +0000 (12:06 -0500)] 
Fix tests on windows

<!-- Provide a general summary of your proposed changes in the Title field above -->
Update the tests to make them run on windows
### Description
<!-- Describe your changes in detail -->
The main changes are:
- Correctly manage the paths on windows vs *nix like system.
- Manage the new lines \r\n vs \n
- Windows cannot remove open files, namely the sqlite db, so it keeps track of the connections and closes them before removing the files.

I've tested with sqlite, postgres and mysql and all pass (on windows 10)

This fixes #632
### 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 documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] 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.

**Have a nice day!**

Closes: #639
Pull-request: https://github.com/sqlalchemy/alembic/pull/639
Pull-request-sha: c6b7794510b5179f6ea574019df79a040e3c5f42

Change-Id: Ibbf7e1da941196d98d6a2e60d5f1bb3a253cca2b

5 years agorender table name with schema
Matthew Sills [Thu, 19 Dec 2019 15:03:12 +0000 (10:03 -0500)] 
render table name with schema

Fixed issue where COMMENT directives for PostgreSQL failed to correctly
include an explicit schema name, as well as correct quoting rules for
schema, table, and column names.  Pull request courtesy Matthew Sills.

Fixes: #637
Closes: #636
Pull-request: https://github.com/sqlalchemy/alembic/pull/636
Pull-request-sha: 703e27bab5b2d0907367dd03a4babb00ea5ee8aa

Change-Id: I319171b0596faf0bbea1b965e094d13acad14b6c

5 years agoAdd pull request template from SQLAlchemy
Mike Bayer [Wed, 18 Dec 2019 15:50:35 +0000 (10:50 -0500)] 
Add pull request template from SQLAlchemy

Change-Id: I9d46fd3737a7190f3b69abd8ba740f06e8c6d3aa

5 years agoVersion 1.3.3 placeholder
Mike Bayer [Mon, 16 Dec 2019 18:47:38 +0000 (13:47 -0500)] 
Version 1.3.3 placeholder

5 years ago- 1.3.2 rel_1_3_2
Mike Bayer [Mon, 16 Dec 2019 18:44:39 +0000 (13:44 -0500)] 
- 1.3.2

5 years agoProvide a context for render_python_code
Mike Bayer [Fri, 13 Dec 2019 15:05:55 +0000 (10:05 -0500)] 
Provide a context for render_python_code

Fixed regression introduced by :ticket:`579` where server default rendering
functions began to require a dialect implementation, however the
:func:`.render_python_code` convenience function did not include one, thus
causing the function to fail when used in a server default context.  The
function now accepts a migration context argument and also creates one
against the default dialect if one is not provided.

Change-Id: I190ddb8fb5bc54c6d850694e0015533c4997b71c
Fixes: #635
5 years agoAdd test for sqlite round trip compare w func.now()
Mike Bayer [Tue, 10 Dec 2019 14:19:00 +0000 (09:19 -0500)] 
Add test for sqlite round trip compare w func.now()

Add explicit test to confirm the issue described
in #634 is not reproducible.

Change-Id: I31c9ba35c501fef0958f15d122ea1674a171d78e

5 years agoAssert scratch directory is cleaned up after class teardown
Mike Bayer [Sat, 30 Nov 2019 17:09:34 +0000 (12:09 -0500)] 
Assert scratch directory is cleaned up after class teardown

Some race conditions are occurring due to the NormPath test
and overall there should be no scratch directories remaining
when tests are complete.

Change-Id: I848b39c4ca473f424a76247abfa4071074808e9d

5 years agoRe-port bootstrap /plugin_base to get combinatoric functions
Mike Bayer [Thu, 28 Nov 2019 00:30:08 +0000 (19:30 -0500)] 
Re-port bootstrap /plugin_base to get combinatoric functions

The py.test combinatoric functions are available in
SQLAlchemy's testing fixtures for version 1.3 and 1.4 only,
not 1.1 or 1.2.

This also needs to port the py.test test collection
function which was improved in SQLAlchemy 1.3 and also
made to accommodate for pytest.combinations, so we must
still vendor a minimum set of the "bootstrap" mechanism
for now.

Change-Id: I21b426cd686a920b2ae60132681afbb645a68246

5 years agoAdd some extra rationale for project-local setup
Mike Bayer [Sat, 16 Nov 2019 15:25:38 +0000 (10:25 -0500)] 
Add some extra rationale for project-local setup

Change-Id: I1c191e0a7189f911128ab8a1363ea821dcc15257

5 years agoRestate installation and tutorial in terms of a virtualenv
Mike Bayer [Sat, 16 Nov 2019 00:13:11 +0000 (19:13 -0500)] 
Restate installation and tutorial in terms of a virtualenv

Since we have things like "cd myproject" in the documentation,
we are assuming some knowledge of how the project is set up.
As the vast majority of projects will have import statements
in their env.py, restate this documentation in terms of a
virtual environment where the local project is installed
in editable mode.

Change-Id: I6a11c5077c02a00145cb882b43d6c9a7c986e375
Fixes: #625