Starting in SQLAlchemy 1.1, the rules for when "autoincrement=True"
may be set on a column are more strict. The migrate tests are
testing the alteration of a column from Integer to String
and then regenerating; this means we need to set autoincrement
to False as well. A related issue in SQLAlchemy 1.1 is
also being fixed (see https://bitbucket.org/zzzeek/sqlalchemy/issues/3835/),
however this fix is not needed in order for the tests to pass here.
Change-Id: Ibd3a75fff13312411df87e17b6e5764865d69728
Brief summary of the modifications:
* Use six for compatibility with both Python 2 and 3;
* Replace UserDict.DictMixin with collections.MutableMapping;
* Fix relative imports;
* Use test-requirements.txt for requirements that are common to both Python 2
and 3, and test-requirements-py{2,3}.txt for version-specific requirements;
* Miscellaneous fixes.
* Use a specific test_db_py3.cfg file for Python 3, that only runs tests on
sqlite.
Thanks to Victor Stinner who co-wrote this patch.
Change-Id: Ia6dc536c39d274924c21fd5bb619e8e5721e04c4
Co-Authored-By: Victor Stinner <victor.stinner@enovance.com>
The assert_() method is deprecated and can be safely replaced by assertTrue().
This patch makes sure that running the tests does not fill the screen with
warnings.
Change-Id: I8966b7f7a44f1573a4d2c398717bfc68ae40b197
Remove all trailing spaces and tabs in every file in the project.
People have editors configured to do this, which causes them to
accidentally make little whitespace changes in unrelated commits,
which makes those commits harder to review. Better to fix them all
at once.
Change-Id: I17d89f55f41d8599e0ab1a31f646cd161289703e
This patch adds the initial support for DB2 10.5 to migrate. It
includes:
1. The dialect implementation for DB2.
2. The dialect registration with the visitor.
3. Code to parse the engine name in version.py.
4. A new dependency on ibm_db_sa in test-requirements.txt.
5. A connection string in test_db.cfg for ibm_db_sa.
Part of blueprint add-db2-support
Co-authored-by: Sheng Bo Hou <sbhou@cn.ibm.com>
Co-authored-by: Thuy Christenson <thuy@us.ibm.com>
Co-authored-by: Rahul Priyadarshi <rahul.priyadarshi@in.ibm.com>
Change-Id: I745ec615487b1b06c5d1a09ea316f376d66ee4c0
Version 0.8 of SQLAlchemy added support of indexes
on expressions in addition to plain table columns,
which changed the way indexes are created.
This broke support of dropping columns of composite
indexes for SQLite: due to limitations of ALTER in
SQLite every time a column is dropped, we recreate
the whole table without the given column; if a
column is a part of a composite index, we change the
index definition to omit that column and then indexes
are recreated too.
SQLAlchemy versions starting from 0.8 no more pay
attention to 'columns' attribute of Index instances
when generating DDL for indexes, so when one of columns
of a composite index is dropped, we try to create a
new index on the column that doesn't exist anymore,
which of course fails.
Closes-Bug: #1241038
Change-Id: I777b8ce36e36f49bfb0889908811a063cf1a527b
In addition to running tests with different Python and SQLAlchemy
versions, they should also be run on different DB backends, which
are used in production (PostgreSQL and MySQL).
This patch:
- modifies test_db.cfg to run tests on PostgreSQL and MySQL
(Jenkins Slave credentials are used here, to ensure these
tests are always run by Jenkins gate); if a backend is not
available, test cases will be skipped for it
- concurrency is set to 1 (sharing of the one MySQL or PostgreSQL
DB among different test runner processes would lead to
race conditions)
- fixes tests dropping FK columns in MySQL: in earlier MySQL
versions dropping a column that is a part of a FK constraint
would lead to dropping of the FK too. As of MySQL 5.5 that's
not the case anymore: if one tries to drop such column, he/she
will get a very obscure error (something like "Error on rename
of './openstack_citest/#sql-4af_aa2' to './openstack_citest/tmp_adddropcol'
(errno: 150)") '\nALTER TABLE tmp_adddropcol DROP COLUMN r2').
So the solution if to drop FK constraints first, and only then
the columns it is made up of
Change-Id: I8c5d2874c83e7df46da69969ed54d85437c849e7