]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
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
5 years agoVersion 1.3.2 placeholder
Mike Bayer [Wed, 13 Nov 2019 14:45:42 +0000 (09:45 -0500)] 
Version 1.3.2 placeholder

5 years ago- 1.3.1 rel_1_3_1
Mike Bayer [Wed, 13 Nov 2019 14:43:10 +0000 (09:43 -0500)] 
- 1.3.1

5 years agoSupport schemas for MSSQL drop server default + FK constraint
Mike Bayer [Tue, 12 Nov 2019 15:01:42 +0000 (10:01 -0500)] 
Support schemas for MSSQL drop server default + FK constraint

Fixed bug in MSSQL dialect where the drop constraint execution steps used
to remove server default or implicit foreign key constraint failed to take
into account the schema name of the target table.

Change-Id: Ia95b043ee6289efbb90d6f21392f4ce622748611
Fixes: #621
5 years agoVersion 1.3.1 placeholder
Mike Bayer [Thu, 31 Oct 2019 16:00:06 +0000 (12:00 -0400)] 
Version 1.3.1 placeholder

5 years ago- 1.3.0 rel_1_3_0
Mike Bayer [Thu, 31 Oct 2019 15:57:56 +0000 (11:57 -0400)] 
- 1.3.0

5 years agoMerge "Accommodate for SQLAlchemy 1.4 deferral of index/unique names"
mike bayer [Mon, 14 Oct 2019 19:26:09 +0000 (19:26 +0000)] 
Merge "Accommodate for SQLAlchemy 1.4 deferral of index/unique names"

5 years agoAccommodate for SQLAlchemy 1.4 deferral of index/unique names
Mike Bayer [Mon, 14 Oct 2019 04:07:55 +0000 (00:07 -0400)] 
Accommodate for SQLAlchemy 1.4 deferral of index/unique names

Some internal modifications have been made to how the names of indexes and
unique constraints work to make use of new functions added in SQLAlchemy
1.4, so that SQLAlchemy has more flexibility over how naming conventions
may be applied to these objects.

Change-Id: I7dc4f6c1c3cf13c503f2ab070afbf157f8f0e0d5

5 years agoMerge "Repair Variant argument order"
mike bayer [Mon, 14 Oct 2019 15:09:06 +0000 (15:09 +0000)] 
Merge "Repair Variant argument order"

5 years ago- repair next release version to be 1.3.0 matching __version__
Mike Bayer [Mon, 14 Oct 2019 14:18:01 +0000 (10:18 -0400)] 
- repair next release version to be 1.3.0 matching __version__

Change-Id: I8689b515698a400af2eee2253c60ead13a109386

5 years agoRepair Variant argument order
Mike Bayer [Mon, 14 Oct 2019 14:15:49 +0000 (10:15 -0400)] 
Repair Variant argument order

Fixed bug in new Variant autogenerate where the order of the arguments to
Variant were mistakenly reversed.

Change-Id: I15cd7d6a926a71005b8b7b9350279846d2886363
Fixes: #131
5 years agoupdates for README.unittests.rst
Mike Bayer [Mon, 14 Oct 2019 04:33:44 +0000 (00:33 -0400)] 
updates for README.unittests.rst

The "setup.py" script was still being referenced erroneously.
Also add a note that starting DB must be empty.

Change-Id: I8c4e70f67fa29fc3b388902b0afac50f9a34d10a
References: #610

5 years agoAllow ALEMBIC_CONFIG for config file location
Mike Bayer [Fri, 11 Oct 2019 15:04:24 +0000 (11:04 -0400)] 
Allow ALEMBIC_CONFIG for config file location

The ALEMBIC_CONFIG environment variable is now used as the
default alembic config file name for the -c option of the
command line runner, if present.

Bump revision to 1.3, as Alembic releases are infrequent,
start using a more semver-like approach to feature adds.

Change-Id: I2fdbd6a1ec2d173037e2e371f8851b0258e3efd5
Fixes: #608
5 years agoClarify sqlalchemy.url in tutorial.rst
Mike Bayer [Thu, 3 Oct 2019 15:43:38 +0000 (11:43 -0400)] 
Clarify sqlalchemy.url in tutorial.rst

Change-Id: Idf47390d132424a2a1998bbe73371d4cce9ce4f3
Fixes: #606
5 years agoVersion 1.2.2 placeholder
Mike Bayer [Tue, 24 Sep 2019 20:36:04 +0000 (16:36 -0400)] 
Version 1.2.2 placeholder

5 years ago- 1.2.1 rel_1_2_1
Mike Bayer [Tue, 24 Sep 2019 17:24:17 +0000 (13:24 -0400)] 
- 1.2.1

5 years agoRevert alembic.stamp "revisions" to "revision"
Thomas Bechtold [Tue, 24 Sep 2019 14:27:03 +0000 (10:27 -0400)] 
Revert alembic.stamp "revisions" to "revision"

Reverted the name change of the "revisions" argument to
:func:`.command.stamp` to "revision" as apparently applications are
calling upon this argument as a keyword name.  Pull request courtesy
Thomas Bechtold.  Special translations are also added to the command
line interface so that it is still known as "revisions" in the CLI.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #601
Closes: #602
Pull-request: https://github.com/sqlalchemy/alembic/pull/602
Pull-request-sha: 4126635e272f82ec53d630bb77c00cb6ff42cec9

Change-Id: I4312954bedc42bb4b76656a70c95b2b7280efae7

5 years agoRemove tests_require
Mike Bayer [Fri, 20 Sep 2019 18:45:36 +0000 (14:45 -0400)] 
Remove tests_require

Removed the "test requirements" from "setup.py test", as this command now
only emits a removal error in any case and these requirements are unused.

Change-Id: I53a798bdedad88d8f9708ed3fb6d8ed1aa49f526
Fixes: #592
5 years agoVersion 1.2.1 placeholder
Mike Bayer [Fri, 20 Sep 2019 14:35:55 +0000 (10:35 -0400)] 
Version 1.2.1 placeholder

5 years ago- 1.2.0 rel_1_2_0
Mike Bayer [Fri, 20 Sep 2019 14:29:00 +0000 (10:29 -0400)] 
- 1.2.0

5 years agoRefer to "pre-commit" not post-commit
Mike Bayer [Fri, 20 Sep 2019 14:27:57 +0000 (10:27 -0400)] 
Refer to "pre-commit" not post-commit

Change-Id: I6ca8a2cc9af3f67f8870a83049bbb241f6dc517c

5 years agoMerge "Render Variant types"
mike bayer [Fri, 20 Sep 2019 14:13:19 +0000 (14:13 +0000)] 
Merge "Render Variant types"

5 years agoAdd --package flag to write __init__.py files
Mike Bayer [Thu, 19 Sep 2019 20:59:27 +0000 (16:59 -0400)] 
Add --package flag to write __init__.py files

Added new flag ``--package`` to ``alembic init``.  For environments where
the Alembic migration files and such are within the package tree and
importable as modules, this flag can be specified which will add the
additional ``__init__.py`` files in the version location and the
environment location.

Change-Id: I4993d17936f2b8a9833a28f0788389b19ff4333e
Fixes: #463
5 years agoRender Variant types
Mike Bayer [Thu, 19 Sep 2019 21:40:06 +0000 (17:40 -0400)] 
Render Variant types

Added rendering for SQLAlchemy ``Variant`` datatypes, which render as the
base type plus one or more ``.with_variant()`` method calls.

Change-Id: Ic0eea1be911c2fb3e9802ec21ff99815a06602e3
Fixes: #131
5 years agoFix NormPathTest again....to not have my workstation paths in it :)
Mike Bayer [Thu, 19 Sep 2019 22:37:28 +0000 (18:37 -0400)] 
Fix NormPathTest again....to not have my workstation paths in it :)

Change-Id: I743f7ec9379a09a4ade4f4e4b03e586c0b06517b

5 years agoFix the NormPathTest to accommodate for multi-process staging directories
Mike Bayer [Thu, 19 Sep 2019 21:45:18 +0000 (17:45 -0400)] 
Fix the NormPathTest to accommodate for multi-process staging directories

Change-Id: Ie1659e51f889bca5d1fe30eb52bc1d5a7aef097c

5 years agoAdd test for normalization of script_dir, version_locations
Mike Bayer [Thu, 19 Sep 2019 20:19:25 +0000 (16:19 -0400)] 
Add test for normalization of script_dir, version_locations

Ensure ScriptDirectory normalizes paths.

Change-Id: I9feea25e03eb3037321341776502619be413080e
References: #590

5 years agoMerge "Add multiple revision support to stamp, support purge"
mike bayer [Thu, 19 Sep 2019 19:29:16 +0000 (19:29 +0000)] 
Merge "Add multiple revision support to stamp, support purge"

5 years agoMerge "Provide revision post-write hooks"
mike bayer [Thu, 19 Sep 2019 17:58:15 +0000 (17:58 +0000)] 
Merge "Provide revision post-write hooks"

5 years agoAdd multiple revision support to stamp, support purge
Mike Bayer [Thu, 19 Sep 2019 03:16:56 +0000 (23:16 -0400)] 
Add multiple revision support to stamp, support purge

Added new ``--purge`` flag to the ``alembic stamp`` command, which will
unconditionally erase the version table before stamping anything.  This is
useful for development where non-existent version identifiers might be left
within the table.  Additionally, ``alembic.stamp`` now supports a list of
revision identifiers, which are intended to allow setting up muliple heads
at once.  Overall handling of version identifiers within the
``alembic.stamp`` command has been improved with many new tests and
use cases added.

Fixes: #473
Change-Id: If06501b69afae9956df3d0bcd739063fb8042a02

5 years agoProvide revision post-write hooks
Mike Waites [Sun, 30 Dec 2018 16:09:27 +0000 (16:09 +0000)] 
Provide revision post-write hooks

Added "post write hooks" to revision generation.   The primary rationale is
to provide for code formatting tools to automatically format new revisions,
however any arbitrary script or Python function may be  invoked as a hook.
The hooks are enabled by providing a ``[post_write_hooks]`` section in the
alembic.ini file.   The provided hook is a command-line runner which
includes configuration examples for running Black or autopep8 on newly
generated revision scripts.

The documentation also illustrates a custom hook that converts Python
source spaces to tabs, as requested in #577.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #307
Fixes: #577
Change-Id: I9d2092d20ec23f62ed3b33d979c16b979a450b48

5 years agoMemoize elements in rewriter; use correct iteration
Mike Bayer [Thu, 19 Sep 2019 01:47:27 +0000 (21:47 -0400)] 
Memoize elements in rewriter; use correct iteration

Modified the logic of the :class:`.Rewriter` object such that it keeps a
memoization of which directives it has processed, so that it can ensure it
processes a particular directive only once, and additionally fixed
:class:`.Rewriter` so that it functions correctly for multiple-pass
autogenerate schemes, such as the one illustrated in the "multidb"
template.  By tracking which directives have been processed, a
multiple-pass scheme which calls upon the :class:`.Rewriter` multiple times
for the same structure as elements are added can work without running
duplicate operations on the same elements more than once.

Change-Id: I2cef13d51912f9d86ddd99b60e4d5b96dbf680ff
Fixes: #505
5 years ago- call the next release 1.2.0
Mike Bayer [Thu, 19 Sep 2019 00:15:52 +0000 (20:15 -0400)] 
- call the next release 1.2.0

Change-Id: I7d0b145afeaff8dfbdbe05d98486bdef3c0b46c2

5 years agoMerge "Support autogenerate for add_column kwargs"
mike bayer [Thu, 19 Sep 2019 00:13:42 +0000 (00:13 +0000)] 
Merge "Support autogenerate for add_column kwargs"

5 years agoMerge "Only allow partial revision match for > 3 characters"
mike bayer [Wed, 18 Sep 2019 01:01:03 +0000 (01:01 +0000)] 
Merge "Only allow partial revision match for > 3 characters"

5 years agoSupport autogenerate for add_column kwargs
Mike Bayer [Tue, 17 Sep 2019 23:00:50 +0000 (19:00 -0400)] 
Support autogenerate for add_column kwargs

Added autogenerate support for :class:`.Column` objects that have
dialect-specific ``**kwargs``, support first added in SQLAlchemy 1.3.
This includes SQLite "on conflict" as well as options used by some
third party dialects.

Change-Id: Iede4ee74e74181f2f2357c6a69c6f3fa0c985392
Fixes: #518