7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: ResultProxy lowercas...
FromSent OnAttachments
Mel Collins24 Mar 2007 11:07 
Michael Bayer24 Mar 2007 12:33 
Mel Collins25 Mar 2007 05:16 
Michael Bayer25 Mar 2007 07:53 
Mel Collins26 Mar 2007 08:50 
Michael Bayer26 Mar 2007 09:08 
Mel Collins27 Mar 2007 07:04 
Subject:[sqlalchemy] Re: ResultProxy lowercasing column names
From:Michael Bayer (mike@zzzcomputing.com)
Date:03/24/2007 12:33:24 PM
List:com.googlegroups.sqlalchemy

theres work going on in ticket 512 to address this, so the try/ excepts are already gone :).

however for the casing, are you just interested in row.keys() being accurate, or are you actually trying to target multiple columns in a single row with the same name but different cases ?

with regards to row.keys(), it should likely be derived from cursor.description. however db's like oracle and firebird will force them to be uppercase in most if not all cases, so dont expect consistent results in your application if you want to be database- agnostic.

On Mar 24, 2007, at 2:07 PM, Mel Collins wrote:

ResultProxy objects always convert column names to lower case, which means you can't easily extract accurate column names from RowProxy objects AFAICT. I'd like to be able to do: dict(table.select().execute().fetchone()) ...and have the keys maintain the case they have in the database. Was there a reason, other than case-insensitive column referencing, why ResultProxy was implemented in this way? Have I missed some nuance in the code?

I've just modified my copy of SA (0.3.6) to remove all those .lower() calls in ResultProxy (and also replaced all those try/excepts), and all my stuff built on SA still seems to work. One of the unit tests now fails though (in addition to constraints.ConstraintTest, which failed already) - inheritance5.RelationTest3 ("self-referential relationships on polymorphic mappers"). There are no uppercase characters in the column names in that test, so I'm at a loss...

Any thoughts/alternate implementations?

Takk, - Mel C