> -----Original Message-----
> From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com]
> On Behalf Of Andrey Semyonov
> Sent: 10 September 2010 14:35
> To: sqlalchemy
> Subject: [sqlalchemy] Re: Python's reserved keywords as column names
> 
> On 10 сен, 17:15, "King Simon-NFHD78" <simon.k...@motorola.com> wrote:
> > Hi Andrey,
> >
> > See the section in the docs 'Attribute Names for Mapped Columns':
> >
> > http://www.sqlalchemy.org/docs/orm/mapper_config.html#attribute-
> names-fo
> > r-mapped-columns
> >
> > Hope that helps,
> >
> > Simon
> 
> Well, this leads to the only way to map in my case named
> 'Declarative'. Because it would fail on
> 
> mapper(Class, table, properties = { '_from': table.c.from })
> 
> Could non-declarative way for mapping python's reserved keywords as
> column names be scheduled as a bug or enhancement request ?
> 
> --
> 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.

The 'c' collection on a Table object allows dictionary-style access, so you 
should be able to use:

  mapper(Class, table, properties = { '_from': table.c['from'] })

Even if that didn't work, you could always use Python's getattr function:

  mapper(Class, table, properties = { '_from': getattr(table.c, 'from') })

Hope that helps,

Simon

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