> I think your code is basically fine, you've just got a mistake on the > last line. Presumably you meant to query Person, not Person.born? >
I want Person.born so that I don't have to get the entire object. It doesn't make much difference in this example, but is quite important for us in practice when we're grabbing multiple expressions. > hybrid_property does't care about the name of the "fget" function, it > just calls it, passing the instance as the only parameter: > > > https://bitbucket.org/zzzeek/sqlalchemy/src/f2eb4aac9517a3775411c2ecf0f588ffd0d790f6/lib/sqlalchemy/ext/hybrid.py?at=master&fileviewer=file-view-default#hybrid.py-744 > > > The call to util.update_wrapper sets the property to have the same name as the fget function, which in turn is used when creating the SQL expression (the self.__name__ expression in the comparator method), which determines the label of the value in the result object. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.