On 05/19/2010 06:47 AM, mte wrote:
Here is a possible reason: SQLAlchemy has a "use_labels" feature
which adds table/alias prefixes to columns in the columns clause to
help disambiguate columns from different tables with the same name. It
could be that your col1 is named in such a way that makes
SQLAlchemy think that "use_labels" is in effect, which could cause it
to not recognize it properly. For example, if "MyClass" uses the "myclass"
table, and col1's name is "myclass_id", then SQLAlchemy may try to
interpret that as the "id" column of "myclass" instead of the
"myclass_id" column. If this is indeed the case, the problem should go away if you really
enable the "use_labels" feature: session.query(MyClass).with_labels().first().col1 If this does not fix it, please post the SQL that is emitted by SQLAlchemy when you use session.query(MyClass).first(). You can see the emitted SQL by passing echo=True to create_engine. -Conor You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. |
- [sqlalchemy] underscore in mssql column names? mte
- Re: [sqlalchemy] underscore in mssql column names? Michael Bayer
- Re: [sqlalchemy] underscore in mssql column names? Conor
