event in 0.6 would get "tables=somecollection",
this behavior is preserved. [ticket:2206]
+ - Fixed bug where "autoincrement" detection on
+ Table would fail if the type had no "affinity"
+ value, in particular this would occur when using
+ the UUID example on the site that uses TypeEngine
+ as the "impl".
+
- engine
- Use urllib.parse_qsl() in Python 2.6 and above,
no deprecation warning about cgi.parse_qsl()
def _autoincrement_column(self):
for col in self.primary_key:
if col.autoincrement and \
+ col.type._type_affinity is not None and \
issubclass(col.type._type_affinity, sqltypes.Integer) and \
not col.foreign_keys and \
isinstance(col.default, (type(None), Sequence)) and \
from test.lib import testing, engines
from sqlalchemy import MetaData, Integer, String, ForeignKey, Boolean, exc,\
Sequence, func, literal, Unicode
-from sqlalchemy.types import TypeDecorator
+from sqlalchemy.types import TypeDecorator, TypeEngine
from test.lib.schema import Table, Column
from test.lib.testing import eq_
from sqlalchemy.dialects import sqlite
id_ = r.inserted_primary_key[0]
nodes.insert().execute(data='bar', parent_id=id_)
+ def test_autoinc_detection_no_affinity(self):
+ class MyType(TypeDecorator):
+ impl = TypeEngine
+
+ assert MyType()._type_affinity is None
+ t = Table('x', MetaData(),
+ Column('id', MyType(), primary_key=True)
+ )
+ assert t._autoincrement_column is None
+
@testing.fails_on('sqlite', 'FIXME: unknown')
def test_non_autoincrement(self):
# sqlite INT primary keys can be non-unique! (only for ints)