[SRU] schema changes using sqlalchemy's sqlite dialect can fail when using reflection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Unassigned | ||
sqlalchemy (Ubuntu) |
Fix Released
|
Undecided
|
Adam Gandelman | ||
Precise |
Fix Released
|
High
|
Unassigned | ||
Quantal |
Fix Released
|
Undecided
|
Adam Gandelman |
Bug Description
[IMPACT]
Sqlalchemy allows models to be generated from existing tables automatically using reflection. The fact that sqlite does not support FK constraints is not properly accounted for in this process and certain schema modifications result in the exception logged in this bug. The most likely way of triggering this fault is through the use of python-migrate and running database migrations against the sqlite dialect.
[TESTCASE]
As of 07/23/2012 (git hash 601882a23dd8a65
ubuntu@
ubuntu@
ubuntu@
This will run through the migrations as part of the test suite, and result in the traceback that ending in: AttributeError: 'int' object has no attribute 'lower'
[Development Fix]
This has been resolved upstream in version 0.7.5 and fixed in Ubuntu 12.10 as of the 0.7.8 Debian sync. http://
[Regression Potential]
Minimal. The minimal fix is a 2 line change that properly sets constraint_name to a None value. The bulk of the patch included in my branch is updates to the sqlalchemy test suite, which is run during our package build.
>> Original bug report <<
Seems to only trigger when running on Ubuntu 12.04 with distro packaged dependencies (that is, not installed from via pip). Exception when attempting to drop the aggregate_
ubuntu@
ubuntu@
ubuntu@
ERROR
=======
ERROR: test suite for <module 'nova.tests' from '/home/
-------
Traceback (most recent call last):
File "/usr/lib/
self.setUp()
File "/usr/lib/
self.
File "/usr/lib/
try_
File "/usr/lib/
return func()
File "/home/
migration.
File "/home/
return IMPL.db_
File "/home/
return versioning_
File "/usr/lib/
return _migrate(url, repository, version, upgrade=True, err=err, **opts)
File "<string>", line 2, in _migrate
File "/home/
return f(*a, **kw)
File "/usr/lib/
schema.
File "/usr/lib/
change.
File "/usr/lib/
script_
File "/home/
aggregate_
File "/usr/lib/
column.
File "/usr/lib/
engine.
File "/usr/lib/
conn.
File "/usr/lib/
**kwargs)
File "/usr/lib/
ret = super(AlterTabl
File "/usr/lib/
return meth(obj, **kw)
File "/usr/lib/
super(
File "/usr/lib/
self.
File "/usr/lib/
table.
File "/usr/lib/
checkfirst=
File "/usr/lib/
**kwargs)
File "/usr/lib/
return meth(obj, **kw)
File "/usr/lib/
self.
File "/usr/lib/
params)
File "/usr/lib/
compiled = ddl.compile(
File "/usr/lib/
return self._compiler(
File "/usr/lib/
return dialect.
File "/usr/lib/
self.string = self.process(
File "/usr/lib/
return obj._compiler_
File "/usr/lib/
return getter(
File "/usr/lib/
const = self.create_
File "/usr/lib/
for constraint in constraints
File "/usr/lib/
return ", \n\t".join(p for p in
File "/usr/lib/
not getattr(constraint, 'use_alter', False)
File "/usr/lib/
return obj._compiler_
File "/usr/lib/
return getter(
File "/usr/lib/
return super(SQLiteDDL
File "/usr/lib/
preparer.
File "/usr/lib/
return self.quote(
File "/usr/lib/
if self._requires_
File "/usr/lib/
lc_value = value.lower()
AttributeError: 'int' object has no attribute 'lower'
Might be of interest, since some are older than what devstack installs:
python-sqlalchemy 0.7.4-1
python-migrate 0.7.2-1ubuntu1
libsqlite3-0 3.7.9-2ubuntu1
Related branches
- Marc Deslauriers: Approve
- Ubuntu branches: Pending requested
-
Diff: 126 lines (+108/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/lp1025544-fix-sqlite-reflection.patch (+99/-0)
debian/patches/series (+1/-0)
description: | updated |
Changed in sqlalchemy (Ubuntu): | |
assignee: | nobody → Adam Gandelman (gandelman-a) |
status: | Confirmed → In Progress |
Changed in sqlalchemy (Ubuntu Precise): | |
status: | New → Fix Released |
description: | updated |
summary: |
- AttributeError in migration 111_general_aggregates.py + [SRU] schema changes using sqlalchemy's sqlite dialect can fail when + using reflection |
Changed in sqlalchemy (Ubuntu Quantal): | |
status: | In Progress → Fix Released |
Changed in sqlalchemy (Ubuntu Precise): | |
importance: | Undecided → High |
status: | Fix Released → In Progress |
This is migration is apparently hitting a bug that was fixed in sqlalchemy 0.7.5:
http:// hg.sqlalchemy. org/sqlalchemy/ rev/2aed4e56676 a