467 Commits

Author SHA1 Message Date
Roman Podoliaka
5feeaba69f Don't run the test if _setup() fails
Change-Id: I2c89c98961044f0e0a1d9b4c2eeea190c5830eed
2015-02-23 17:03:25 +02:00
Yuval Langer
c8c5c4bdd8 Correcting minor typo
Change-Id: Ib8b897414039224971a1535c268c8a21fc3534fb
2015-02-22 14:03:55 +02:00
Matt Riedemann
ae64d828df allow dropping fkeys with sqlite
This implements the ability to drop foreign keys
with sqlite. It's basically the same implementation
used for dropping unique constraints so the common
code is refactored.

The existing FKey test that was skipping sqlite is
no longer skipped to show this works.

Change-Id: Idaaf4229e34af4c21c3bcead4b4e22491d24238e
Closes-Bug: #1423955
2015-02-20 10:04:35 -08:00
Mike Bayer
997855db3b Add pretty_tox setup
This changeset adds the pretty_tox script runner to SQLAlchemy-migrate,
so that current test runs can be viewed clearly.

Change-Id: I3884703e24cb636983a0202c46899c772419d401
2015-01-29 15:19:02 -05:00
Jenkins
75034abe51 Merge "Update requirements file matching global requ" 2015-01-27 15:20:40 +00:00
Jenkins
6aca7a17fc Merge "Work toward Python 3.4 support and testing" 2015-01-15 23:04:03 +00:00
Jenkins
0a618361ba Merge "Fixes the auto-generated manage.py" 2015-01-15 22:53:59 +00:00
Jenkins
a15a7cec42 Merge "Replace assertNotEquals with assertNotEqual." 2015-01-15 22:18:05 +00:00
Monty Taylor
b011e6cb39 Remove svn version tag setting
This is confusing our poor friend setuptools into appending a post0 on
to release versions.

Change-Id: I59a763f00f47d9a2fb0d26428a41fee82deff49d
0.9.4
2015-01-12 16:21:02 -08:00
Jenkins
25c7d750f5 Merge "pep8: mark all pep8 checks that currently fail as ignored" 0.9.3 2015-01-11 10:38:02 +00:00
Jenkins
397682b9c8 Merge "Use native sqlalchemy 0.9 quote attribute with ibmdb2" 2015-01-10 00:03:23 +00:00
Ihar Hrachyshka
938757e7aa Ignore transaction management statements in SQL scripts
Now that we don't run SQL script with a single .execute() call,
transaction management statements (BEGIN, COMMIT, END) fail with
operational error. Ignore them if occurred in a script.

All in all, transactions are managed by SQLAlchemy-migrate itself, so
there is no reason for the calling code to pass those statements in a
SQL script. Warn user about the statements that are ignored.

The ideal response to such a warning from library users is removing
those redundant transaction management statements from their scripts.

Note: ROLLBACK is not ignored even though it's one of transaction
management statements because its usage in migration scripts is insane
anyway, and we're better fail on it and not (almost) silently ignore it.

Change-Id: Ie4179c0e9341d42656d66821aaac23f8dcd33927
Closes-bug: 1368391
2015-01-09 14:32:27 -08:00
Rahul Priyadarshi
74553f426c Use native sqlalchemy 0.9 quote attribute with ibmdb2
Commit 8d6ce64cd08c0598963a92844495782997cd59f3 started using the native
quote attribute built into sqlalchemy 0.9 but missed the changes to the
ibmdb2 changeset, so alter table statements fail for DB2 on sqlalchemy
>= 0.9 (tested against 0.9.8).

This fixes the same issue for the ibmdb2 changeset.

Change-Id: Ia3fa6c3090b5eab29ed7746f4795d502990b8a2f
2015-01-09 14:31:28 -08:00
Brant Knudson
244c6c55d7 Don't add warnings filter on import
The changeset module was adding a warnings filter on import. This
affects all applications that wind up importing it. A library
shouldn't modify the warnings filters unless asked.

Closes-Bug: #1407736
Change-Id: I893f8be48efd3d3642e977ab587c9e6dc867258b
2015-01-08 16:22:59 -06:00
Cyril Roelandt
677f374a68 Replace assertNotEquals with assertNotEqual.
The former is deprecated and the latter should be used.

Change-Id: I9d6dca41cb737062e6d4467c24dbc88901ab9a14
2014-10-30 08:56:50 +01:00
Jenkins
1e83840c98 Merge "Fix ibmdb2 unique constraint handling for sqlalchemy 0.9" 2014-10-10 12:32:25 +00:00
Longgeek
cee9136256 Update requirements file matching global requ
* update the pbr version
* update the sqlalchemy version

Change-Id: I21364e2b00d0d5cb9428f8ede1ca0e14aad390fc
2014-09-12 19:52:02 +08:00
Jeremy Stanley
c14a311a48 Work toward Python 3.4 support and testing
Change-Id: Idcf09fcbab416bc7af201e7244ba375b5ba1d430
2014-09-03 20:06:21 +00:00
Ihar Hrachyshka
30f6aeab91 pep8: mark all pep8 checks that currently fail as ignored
Change-Id: Ic1dfb51598b920611acb1a0e437a32c5af90beda
2014-08-23 21:34:13 +02:00
Ihar Hrachyshka
93ae21007d SqlScript: execute multiple statements one by one
Some drivers [f.e. MySQL Connector] do not like multiple statements
being passed to .execute(). They require either passing multi=True
parameter to .execute() that is not DB-API 2.0 defined, or executing
those statements one by one.

For that patch, I've chosen the second option to stay away from driver
specific hacks.

Also removed SQLite hack that seems to be related to the same multiple
statements issue.

blueprint enable-mysql-connector

Change-Id: Ic6d53ed1fef8aee9471f3540f06b39cd5ee4ef82
0.9.2
2014-08-23 21:34:13 +02:00
Ihar Hrachyshka
be1dd6730a Make sure we don't throw away exception on SQL script failure
If SQL script failed, we don't currently log the failure anywhere, so
users have hard time debugging an issue, if anything arises.

Let's log the failure before proceeding with rollback.

Change-Id: Ic92b1403c00bb238a68265a15150a4be6f6b2346
2014-08-23 21:34:13 +02:00
Ihar Hrachyshka
feb0c15aee Pin testtools to < 0.9.36
New testtools require that setUp() and tearDown() are not called twice,
while test_schema is built around multiple calls. So pinning the version
for now until a proper fix is implemented.

Closes-Bug: 1360252
Change-Id: I184db35242d036dacc7933c1d762cccc7f5c40bb
2014-08-23 21:34:07 +02:00
Matt Riedemann
7bb74f70e9 Fix ibmdb2 unique constraint handling for sqlalchemy 0.9
The ibmdb2 unique constraint code was accessing the private _all_cols
member var in iterating over columns which breaks in sqlalchemy 0.9 so
fix up the code to not use internals of sqlalchemy.

UniqueConstraint in sqlalchemy extends ColumnCollectionConstraint
which implements __iter__ to generate a tuple of the columns in
the constraint, so we just iterate over the constraint as the fix.

This is based on a patch from Rahul Priyadarshi in ibm-db-sa issue
158:

https://code.google.com/p/ibm-db/issues/detail?id=158

Co-Authored-By: Rahul Priyadarshi <rahul.priyadarshi@in.ibm.com>

Change-Id: I0f06f6314c382e83573d762abe5981db0a02a83a
2014-08-04 07:34:08 -07:00
Peter Conerly
5542e1c59a Fixes the auto-generated manage.py
Removes `six` from the locals().copy() so that it won't be templated into
manage.py.  Currently manage.py is mis-templated and is failing.

Change-Id: Ib3b7c7caac998fbaa45c3370547c9b8bf13abe41
Closes-Bug: 171
2014-08-02 11:41:39 -07:00
Jenkins
942e03b2b1 Merge "Fix 3 files with Windows line endings to Unix line endings." 2014-07-22 21:48:39 +00:00
Jenkins
089663761c Merge "Move patch from oslo to drop unique constraints with sqlite" 0.9.1 2014-05-05 15:15:03 +00:00
Matt Riedemann
93efb62fd1 Move patch from oslo to drop unique constraints with sqlite
oslo-incubator commit 3f503faac for making sqlite work with dropping
unique constraints in database migrations. This was made in
oslo-incubator since at the time sqlalchemy-migrate was not in
stackforge. Now that we can update sqlalchemy-migrate, move the patch
over from oslo.

This change also adds the support for the case that a unique constraint
is dropped because the column it's on is dropped.

Note that there are already unit tests that cover dropping a unique
constraint directly and implicitly via dropping a column that is in
the unique constraint.

Related-Bug: #1307266

Change-Id: I5ee8082a83aebf66f6e1dacb093ed79e13f73f5e
2014-04-15 19:22:03 -07:00
Cyril Roelandt
a03b141a95 Port to Python3
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>
2014-04-09 17:32:52 +02:00
Cyril Roelandt
07909159ae tests: Replace "self.assert_" by "self.assertTrue"
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
2014-03-31 15:08:29 +02:00
Jenkins
fad07f1c8e Merge "Convert tabs to spaces in a couple of rst files" 2014-03-29 18:27:34 +00:00
Jenkins
e20068490b Merge "Eradicate trailing whitespace" 2014-03-29 18:27:33 +00:00
Sean Dague
0b08e91df2 turn on testing for sqla 0.9
this enables tox testing for the sqla 0.9 changes, and provides
new targets for sqla 0.9 and 0.8.

Change-Id: I297dce0267bd10cd7db0fe270945c8e5a3431167
0.9
2014-03-05 08:20:54 -05:00
Thomas Goirand
7161cf2c9e Replace AbstractType by TypeEngine
AbstractType not longer exists in the class  hierarchy for types.
TypeEngine was its direct descendant, so use that instead.

Change-Id: Idbfaee4b0d3acbc4795913ddf2ab4e1c9b6d065c
2014-03-05 08:20:54 -05:00
Thomas Goirand
b58b4a353c fix scripttest compat
There's no script_path param in the current version of
scripttest. This patch fixes that by removing the param,
which by the way isn't useful.

Change-Id: Ic78cea25bb472702473e98b48a8ff74c01545aa3
2014-03-05 08:20:54 -05:00
Thomas Goirand
8d6ce64cd0 Use native quote attribute introduced in sqla 0.9
In SQLA 0.9 there is now a native .quote attribute on many objects.
Conditionally use this instead of the old method if the attribute
exists, to remove deprecation messages (and prepare for when the
other way will be fully removed).

Change-Id: I3c5fada13e044c1c4102acc0455226ce1524f2e2
2014-03-05 08:20:49 -05:00
Thomas Goirand
bcb6991615 Fix genmodel for SQLA 0.9
Problem:
* Some python code was auto generated and exec'ed in that
package.
* The python code that was problematic had a 'Table' definition
* The generated code imports '*' from sqlalchemy
* One among the 'Column' was defined as an 'INTEGER' type, which
points to sqlalchemy.sql.sqltypes.INTEGER
* The INTEGER class was initialised with a parameter display_width
which contradicts with sqlalchemy.sql.sqltypes.INTEGER.__init__,
which does not accept any parameters
* The 'INTEGER' class should have been imported from mysql dialects'
type module
Solution:
* While generating, in the header part, I am now checking if any of
the column.type.__class__.__name__ has 'dialects' in it.
* If I find any, I am adding the import rule such that the type is
imported from the dialects' type.

This patch has been tested with SQLA 0.9.3, for which it fixes the
unit tests, and with SQLA 0.8.2, which doesn't have (new) problems
with this patch.

Change-Id: Ie0e09b45388462629100017bea3ea8a314d148d8
2014-03-05 06:55:25 -05:00
Jenkins
0ffaaae935 Merge "UniqueConstraint named and escaped twice" 2014-03-05 08:46:17 +00:00
Jenkins
716124f2ad Merge "Conditionally import ibmdb2/ibm_db_sa" 2014-03-04 20:38:53 +00:00
Matt Riedemann
12a6bcfa8c Conditionally import ibmdb2/ibm_db_sa
Since ibm_db_sa is not part of sqlalchemy, we need to handle the
conditional import of the module in visitor.py so we don't get an
ImportError if ibm_db_sa is not available.

Closes-Bug: #1287229

Change-Id: Ida070b629ce3b9be727ae49973bb6a71543c1dcf
2014-03-04 10:12:40 -08:00
Thomas Goirand
f944414bd4 migrate needs subunit >= 0.0.18
The unit tests of subunit are failing with an older version of
subunit, so we need to fix the test-requirements.txt to reflect
the reality.

Change-Id: I786c70a02196b00fb0d96feb5fd1a0b5281f6672
2014-03-02 15:18:31 +08:00
Thomas Goirand
98ae3ac832 UniqueConstraint named and escaped twice
This patch fixes get_constraint_name in the
ANSIConstraintCommon class. It's part of the
fixes needed for SQLA 0.9.x compat.

Change-Id: I1f1648af48f459bd18f99bb42fa9a272186fb37d
2014-03-02 13:12:45 +08:00
David Ripton
6502d4017a Fix 3 files with Windows line endings to Unix line endings.
Change-Id: Iadc8e5d195bf998a117da4b7102a8955e238dd4e
2014-02-27 10:32:17 -05:00
David Ripton
d6fbf12989 Eradicate trailing whitespace
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
2014-02-26 15:04:54 -05:00
David Ripton
82f739b96f Convert tabs to spaces in a couple of rst files
These restructured text files mostly use spaces, but a few stray
tabs crept in.  Change them for consistency.

Change-Id: I89f390d02c737798007423a5126d81ad3d9e032e
2014-02-26 15:00:50 -05:00
Jenkins
21fcdad0f4 Merge "Add DB2 10.5 Support" 0.8.3 0.8.4 2014-02-23 19:16:52 +00:00
Sean Dague
fe148d87b4 uncap SQLA in requirements.txt
migrate can't just take a global requirements sync because it
needs to be tested against multiple versions of SQLA to assure
compatibility. A recent change had the effect of only testing
migrate against SQLA 0.7, which is definitely *not* what we
want to be doing.

this reverts that change, and leaves very specific comments to
hopefully prevent this from happening in the future.

Change-Id: Icb4e136f0de6caa224019bb955341c4b67c5e1a1
0.8.5
2014-02-23 11:38:53 -05:00
Matt Riedemann
85317aead6 Add DB2 10.5 Support
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
2014-02-17 07:17:31 -08:00
Sascha Peilicke
d58e47f85c Sync with global requirements
Change-Id: If05a5d65558ca848b80c3f57c19cb5029adbe58a
2014-02-12 16:46:49 +01:00
Eric Harney
ce351c06be Fix broken development version link in README
Change-Id: Id9035c167d397cdad32d418c37108586344d8edc
2013-11-15 13:41:47 -05:00
Monty Taylor
928a846619 Un-break the version in migrate/__init__.py
Change-Id: Ie642315c20866435a709d576c99d6e293e7a7e63
0.8.2
2013-11-15 13:04:56 -05:00