On Jun 10, 2010, at 12:06 AM, Mike Bernson wrote:

> I am trying to access a postgres database with mixed case column names.
> 
> I am using reflection to get the table.
> 
> Here is my connect string:
> 'postgresql://:mike@/cedar_senior_services'
> 
> 
> The error message:
> (ProgrammingError) column "active" does not exist
> LINE 1: select * from license where Active=E'yes' and LicenseType=E'...
>                                    ^
> 'select * from license where Active=%(Active)s and 
> LicenseType=%(LicenseType)s' {'Active': 'yes', 'LicenseType': 'ADMIN'}
> 
> The error message is correct that active does not exist but Active is the 
> requested column.
> 
> How do I get sqlalchemy when using postgres to quote thing so that looks for
> same case column names.
> 
> Using Sqlalchemy 6.1 with postgres 8.4.4
> 
> The follow selection does work:
> select * from license where "Active"='yes' and "LicenseType"='ADMIN';
> 
> Since this is my first try as using postgres from sqlalchemy I am sure that
> I must by missing something simple on the connection url or create engine.

any column name with capital letters in it will be quoted in all cases.   If 
you are using table metadata and its spitting out "Active" without quotes, 
thats a huge bug, although above that looks like a hand-coded statement.   

Using a table with a column named "Active" I get:

SELECT t1."Active" FROM t1






-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to