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')``.
Mike Bayer [Tue, 2 Jan 2018 22:10:43 +0000 (17:10 -0500)]
Disable index quoting when applying truncated DDL rules
Fixed regression caused by :ticket:`421` which would
cause case-sensitive quoting rules to interfere with the
comparison logic for index names, thus causing indexes to show
as added for indexes that have case-sensitive names.
Mike Bayer [Wed, 25 Oct 2017 19:24:29 +0000 (15:24 -0400)]
Resolve Postgresql implicit indexes via duplicates_constraint
Fixed bug where autogenerate would produce a DROP statement for the index
implicitly created by a Postgresql EXCLUDE constraint, rather than skipping
it as is the case for indexes implicitly generated by unique constraints.
Makes use of SQLAlchemy 1.0.x's improved "duplicates index" metadata and
requires at least SQLAlchemy version 1.0.x to function correctly.
Mike Bayer [Wed, 11 Oct 2017 21:17:19 +0000 (17:17 -0400)]
Clean up all Python 3.6 warnings
Fixed a few Python3.6 deprecation warnings by replacing ``StopIteration``
with ``return``, as well as using ``getfullargspec()`` instead of
``getargspec()`` under Python 3.
Additionally fixed docstrings with backslashes needing r'', filehandles
not explicitly closed, accommodate for .pyc files not necessarily present.
Mike Bayer [Wed, 11 Oct 2017 13:53:22 +0000 (09:53 -0400)]
Clean up _fk_colspec() for link_to_name, no column found
A :class:`.ForeignKeyConstraint` can now render correctly if the
``link_to_name`` flag is set, as it will not attempt to resolve the name
from a "key" in this case. Additionally, the constraint will render
as-is even if the remote column name isn't present on the referenced
remote table.
Mike Bayer [Wed, 11 Oct 2017 14:08:19 +0000 (10:08 -0400)]
Append table name to batch temp name
The name of the temporary table in batch mode is now generated
off of the original table name itself, to avoid conflicts for the
unusual case of multiple batch operations running against the same
database schema at the same time.
Mike Bayer [Wed, 4 Oct 2017 20:01:33 +0000 (16:01 -0400)]
Accommodate for mariadb 10.2 function reflection style
Fixed bug where server default comparison of CURRENT_TIMESTAMP would fail
on MariaDB 10.2 due to a change in how the function is
represented by the database during reflection.
Also implement mariadb 10.2 checks from SQLAlchemy to skip
other CHECK contraint related tests that can't pass.
Mike Bayer [Sat, 16 Sep 2017 00:25:43 +0000 (20:25 -0400)]
Add + to illegal revision characters list
An addition to :ticket:`441` fixed in 0.9.5, we forgot to also filter
for the ``+`` sign in migration names which also breaks due to the relative
migrations feature.
Mike Bayer [Thu, 7 Sep 2017 21:43:00 +0000 (17:43 -0400)]
Support pep3149, latest import mechanics, fully
Reworked "sourceless" system to be fully capable of handling any
combination of: Python2/3x, pep3149 or not, PYTHONOPTIMIZE or not,
for locating and loading both env.py files as well as versioning files.
This includes: locating files inside of ``__pycache__`` as well as listing
out version files that might be only in ``versions/__pycache__``, deduplicating
version files that may be in ``versions/__pycache__`` and ``versions/``
at the same time, correctly looking for .pyc or .pyo files based on
if pep488 is present or not. The latest Python3x deprecation warnings
involving importlib are also corrected.
Mike Bayer [Wed, 6 Sep 2017 14:20:39 +0000 (10:20 -0400)]
Use env in history when revision_history=true
The ``alembic history`` command will now make use of the revision
environment ``env.py`` unconditionally if the ``revision_environment``
configuration flag is set to True. Previously, the environment would
only be invoked if the history specification were against a database-stored
revision token.
pg3-ivan [Fri, 25 Aug 2017 14:02:31 +0000 (10:02 -0400)]
Don't compare scale if Numeric has no precision
Fixed bug where comparison of ``Numeric`` types would produce
a difference if the Python-side ``Numeric`` inadvertently specified
a non-None "scale" with a "precision" of None, even though this ``Numeric``
type will pass over the "scale" argument when rendering. Pull request
courtesy Ivan Mmelnychuk.