Mike Bayer [Mon, 4 Mar 2019 14:37:08 +0000 (09:37 -0500)]
Clarify and correct PostgreSQL server default comparison for py37
Fixed issue where server default comparison on the PostgreSQL dialect would
fail for a blank string on Python 3.7 only, due to a change in regular
expression behavior in Python 3.7.
Mike Bayer [Thu, 7 Feb 2019 15:04:41 +0000 (10:04 -0500)]
Repair tests for SQLAlchemy 1.3 safestring change
Latest 1.3 includes checks for valid SQL keywords and applies
column() to the element of ExcludeConstraint, adjust tests to
work for this as well as previous behavior.
Damien Garaud [Wed, 23 Jan 2019 16:13:37 +0000 (11:13 -0500)]
Fix single quote escaping for the SQL comments
Fixed issue in new comment support where autogenerated Python code
for comments wasn't using ``repr()`` thus causing issues with
quoting. Pull request courtesy Damien Garaud.
Mike Bayer [Fri, 11 Jan 2019 20:40:10 +0000 (15:40 -0500)]
Update comment documentation, make sure tests always run
Corrected the links and text in the changelog note as well as
ensured new comment-oriented methods and parameters include a
versionadded token. Added a more specific check so that
any run of the tests will make sure SQLAlchemy issue 4436
is resolved as 1.2.16 resolves it but 1.3.0b1, which currently
comes out for "python setup.py test", does not.
Mike Waites [Fri, 31 Aug 2018 18:56:36 +0000 (19:56 +0100)]
Implemented support for Table and Column Comments
Added Table and Column level comments for supported backends.
`create_table`, `add_column` and `alter_column` now optionally
take `comment="X"` kwarg. Support for autogenerate for Table
and Column objects has also been added
Mike Bayer [Fri, 28 Dec 2018 14:05:27 +0000 (09:05 -0500)]
reword op.execute()
Apparently op.execute() makes use of _exec() which coerces strings
into text() constructs. This is less than ideal, however for now
document the caveat that colons need to be escaped.
Stefan Tjarks [Thu, 22 Nov 2018 03:08:56 +0000 (22:08 -0500)]
Vendor python3 formatargspec, import from collections.abc
Resolved remaining Python 3 deprecation warnings, covering
the use of inspect.formatargspec() with a vendored version
copied from the Python standard library, importing
collections.abc above Python 3.3 when testing against abstract
base classes, fixed one occurrence of log.warn(), as well as a few
invalid escape sequences.
Add DeprecationWarning to the test suite as an error raise
as has been the case within SQLAlchemy for some time now.
Fixes: #507 Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I121121b3d2dd90e6f3c9b16dec2fc80b9699c400
Pull-request: https://bitbucket.org/zzzeek/alembic/pull-requests/85
Mike Bayer [Wed, 14 Nov 2018 18:53:57 +0000 (13:53 -0500)]
Check for mssql_include is None
Fixed regression caused by :ticket:`513`, where the logic to consume
``mssql_include`` was not correctly interpreting the case where the flag
was not present, breaking the ``op.create_index`` directive for SQL Server
as a whole.
Mike Bayer [Wed, 24 Oct 2018 17:44:09 +0000 (13:44 -0400)]
Dont autogenerate "system=True", render flag correctly
The ``system=True`` flag on :class:`.Column`, used primarily in conjunction
with the Postgresql "xmin" column, now renders within the autogenerate
render process, allowing the column to be excluded from DDL. Additionally,
adding a system=True column to a model will produce no autogenerate diff as
this column is implicitly present in the database.
Mike Bayer [Fri, 19 Oct 2018 14:00:50 +0000 (10:00 -0400)]
Add special handling for SQL Server create_index mssql_includes
Fixed issue where usage of the SQL Server ``mssql_include`` option within a
:meth:`.Operations.create_index` would raise a KeyError, as the additional
column(s) need to be added to the table object used by the construct
internally.
Mike Bayer [Wed, 17 Oct 2018 14:14:22 +0000 (10:14 -0400)]
Replace union_update with update
Fixed issue where removed method ``union_update()`` was used when a
customized :class:`.MigrationScript` instance included entries in the
``.imports`` data member, raising an AttributeError.
Mike Bayer [Wed, 17 Oct 2018 14:09:50 +0000 (10:09 -0400)]
Revert "Replace set union_update() references with update()"
This reverts commit 7e3d032cc92af73988f02f281ab354de7fc8e3ab. the
PR was not provided with a test case or bug report and this is actually
an uncovered code bug. will re-submit with a proper bug report
Luis Calderon [Tue, 16 Oct 2018 13:38:54 +0000 (09:38 -0400)]
Replace set union_update() references with update()
The autogenerate api references the `union_update()` method of sets which was removed in Python 2.4. The previous method is actually an alias for the `update()` method.
This PR replaces the api reference with the correct one for Python 2.7
Mike Waites [Fri, 31 Aug 2018 19:42:27 +0000 (19:42 +0000)]
Don't format output twice in writer
Fixed an issue where revision descriptions were essentially
being formatted twice. Any revision description that contained
characters like %, writing output to stdout will fail because
the call to config.print_stdout attempted to format any
additional args passed to the function.
This fix now only applies string formatting if any args are provided
along with the output text.
Mike Bayer [Fri, 31 Aug 2018 20:24:16 +0000 (16:24 -0400)]
Run batch tests per backend
Seeing a new unexpected success in limited scope for mysql,
correlating with addition of mariadb 10.3 to CI. This test
should be producing db-specific successes/failures to track
it more easily
Mike Bayer [Wed, 11 Jul 2018 18:05:02 +0000 (14:05 -0400)]
Remove column from primary key when dropping
Fixed issue in batch where dropping a primary key column, then adding it
back under the same name but without the primary_key flag, would not remove
it from the existing PrimaryKeyConstraint. If a new PrimaryKeyConstraint
is added, it is used as-is, as was the case before.
Hugo [Sat, 9 Jun 2018 14:41:43 +0000 (17:41 +0300)]
Drop Python 2.6 / 3.3 support
For Alembic 1.0, Python 2.6 / 3.3 support is being dropped, allowing a
fixed setup.py to be built as well as universal wheels. Pull request
courtesy Hugo.
elad [Fri, 29 Jun 2018 15:13:43 +0000 (11:13 -0400)]
Render autogenerate=True if present
Fixed issue where "autoincrement=True" would not render for a column that
specified it, since as of SQLAlchemy 1.1 this is no longer the default
value for "autoincrement". Note the behavior only takes effect against the
SQLAlchemy 1.1.0 and higher; for pre-1.1 SQLAlchemy, "autoincrement=True"
does not render as was the case before. Pull request courtesy Elad Almos.
Mike Bayer [Fri, 18 May 2018 14:23:22 +0000 (10:23 -0400)]
Use external impl for type rendering
The render_type() method of DefaultImpl was hardcoded to
only work for SQLAlchemy types. Most of the work here involves
adding a proof of concept suite illustrating an external dialect
fully rendering types and nested types with imports.
Mike Bayer [Fri, 18 May 2018 15:11:49 +0000 (11:11 -0400)]
Implement native boolean check constraint flag in test suite
This is based on
https://github.com/zzzeek/sqlalchemy/commit/d2bacad469c0b07cc707b563e37e835abcf96eb8
which adds further specificity to SQL Server's boolean behaviors,
the test suite here expects a CHECK constraint to be rendered.
The "op.drop_constraint()" directive will now render using ``repr()`` for
the schema name, in the same way that "schema" renders for all the other op
directives. Pull request courtesy Denis Kataev.
misebox [Wed, 7 Mar 2018 21:20:00 +0000 (16:20 -0500)]
Add indicate-current option into history command
Added new flag ``--indicate-current`` to the ``alembic history`` command.
When listing versions, it will include the token "(current)" to indicate
the given version is a current head in the target database. Pull request
courtesy Kazutaka Mise.
Mike Bayer [Mon, 19 Feb 2018 21:43:22 +0000 (16:43 -0500)]
Remove erroneous skip message
The logic here seems to try to say something different when
__backend__ is True but it produces a nonsensical message,
since __only_on__ doesn't tell us about the implementation
we are actually running.
Mike Bayer [Mon, 19 Feb 2018 19:00:11 +0000 (14:00 -0500)]
Repair server default comparison for MySQL / MariaDB
The regexp for comparing the TIMESTAMP function
was obliterating all other comparisons as it was incorrect.
Add new regexp for integers that also adjusts for
mariadb 10.2 quoting differences vs. mariadb 10.1
Mike Bayer [Fri, 16 Feb 2018 15:07:20 +0000 (10:07 -0500)]
Repair as_revision_number to return a tuple for "heads"
Fixed bug where the :meth:`.Script.as_revision_number` method
did not accommodate for the 'heads' identifier, which in turn
caused the :meth:`.EnvironmentContext.get_head_revisions`
and :meth:`.EnvironmentContext.get_revision_argument` methods
to be not usable when multiple heads were present.
The :meth:.`EnvironmentContext.get_head_revisions` method returns
a tuple in all cases as documented.
Mark Amery [Sun, 7 Jan 2018 12:22:52 +0000 (12:22 +0000)]
Add Python docs to intersphinx_mapping
This allows refs like the ConfigParser one at
http://alembic.zzzcomputing.com/en/latest/tutorial.html
to automatically get turned into links, and suppresses
the warning about them not being found when running 'make html'
Mike Bayer [Fri, 26 Jan 2018 15:02:16 +0000 (10:02 -0500)]
Add HSTORE to render_type_w_subtype
Fixed the autogenerate of the module prefix
when rendering the text_type parameter of
postgresql.HSTORE, in much the same way that
we do for ARRAY's type and JSON's text_type.
Mike Bayer [Tue, 23 Jan 2018 17:38:28 +0000 (12:38 -0500)]
Detect indexes for table that's dropped
Fixed bug where the indexes would not be included in a
migration that was dropping the owning table. The fix
now will also emit DROP INDEX for the indexes ahead of time,
but more importantly will include CREATE INDEX in the
downgrade migration.
Mike Bayer [Tue, 23 Jan 2018 22:33:49 +0000 (17:33 -0500)]
Add DROP CONSTRAINT to MySQL for mariadb
Added support for DROP CONSTRAINT to the MySQL Alembic
dialect to support MariaDB 10.2 which now has real
CHECK constraints. Note this change does **not**
add autogenerate support, only support for op.drop_constraint()
to work.
Mike Bayer [Mon, 22 Jan 2018 19:40:23 +0000 (14:40 -0500)]
Render ExcludeContraint Column as column, not plain string
Fixed bug where autogenerate of :class:`.ExcludeConstraint`
would render a raw quoted name for a Column that has case-sensitive
characters, which when invoked as an inline member of the Table
would produce a stack trace that the quoted name is not found.
An incoming Column object is now rendered as ``sa.column('name')``.