I am running ActiveState\'s ActivePython 2.6.5.12 and PostgreSQL 9.0 Beta 1 under Windows XP.
If I create a table with an upper case first letter (i.e. Books), psyco
I often have to use Psycopg2 with tables that have been created by other people and they use a lot of case mixing in their column names.
The solution I found is to use
from psycopg2.extensions import AsIs
and to then put the column name in a variable like:
column_name = '"Column_Mixed_Case"'#Mind the '" quotes combination !
and pass the variable to the sql as follows
data = AsIs(column_name)
sql = "select %s from table"
cur.execute(sql,data)