Sqlalchemy+sqlite Stripping Column Names With Dots?
I am using SQLAlchemy 0.7.6. I am aliasing columns with: column = table.c['name'].label('foo.bar') and SQLite uses only 'bar' as result field alias. Is there any workaround for th
Solution 1:
Going to be patched in SQLAlchemy with an engine option. See mailing list thread for more information.
Meanwhile, the workaround is:
# select is sqlalchemy.sql.expression.select()
# each selected column was derived as column = table.c[reference].label(label_with_dot)
labels = [c.name for c in select.columns]
...
record = dict(zip(labels, row))
Solution after patch is :
conn = engine.connect().execution_options(sqlite_raw_colnames=True)
result = conn.execute(stmt)
Post a Comment for "Sqlalchemy+sqlite Stripping Column Names With Dots?"