zzzeek/sqlalchemy — pull request #72 by malor (2014-02-14 12:27:20+00:00)
Title: Fix unique constraints reflection in SQLite

Reflection of unique constraints didn't work properly, if reserved
identifiers had been used as column names. In this case column names
would be put in double quotes (e.g. the name of column asc would be
returned as "asc").

This issue is only present in 0.8.4 and not in 0.9.x (looks like this had been fixed in 0.9.x but was not backported to 0.8.x).

The snippet to reproduce:

import sqlalchemy as sa

eng = sa.create_engine('sqlite://')
meta = sa.MetaData(bind=eng)

table = sa.Table(
'testtbl', meta,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('asc', sa.Integer),
sa.Column('key', sa.Integer),
sa.UniqueConstraint('asc', 'key', name='uniq_asc_key')
)
table.create()

inspector = sa.inspect(eng)
print inspector.get_unique_constraints('testtbl')