There's no straightforward way to do that.   Schemes to copy each Table to a 
new one with a lowercase ".key" attribute, using Inspector to generate the 
Table object programatically (basically means, implement your own 
Inspector.reflecttable()), subclassing Inspector (since it currently calls 
Table() for related tables, so you'd have to patch your Inspector class onto 
the dialect, i.e. engine.dialect.inspector=MyInspector), come to mind.   That 
last idea might be the easiest.

There is an easy way to *map* the columns with custom names though.  If you're 
mapping, you'd use a function to generate a new "properties" dictionary like 
the one at 
http://www.sqlalchemy.org/docs/orm/mapper_config.html#attribute-names-for-mapped-columns
 .


On Jan 11, 2011, at 3:47 PM, Harkirat wrote:

> Hi,
>     Is there any way that anyone knows of to force the column names
> to be lowercase when reflecting the schema from the database for e.g.
> appname = Table('appname', metadata, autoload=True)
> 
> Other posts suggested overriding the database schema with your own but
> I would rather use SQLAlchemy's reflection mechanism but somehow force
> the lowercase in the column names. Can I do this via some easy tweak
> or hack that someones knows about (possibly modifying the underlying
> SQLAlchemy reflection code contained in reflection.py)?
> 
> -- 
> 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.
> 

-- 
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