On 08/27/2010 09:21 PM, Michael Bayer wrote:
you coerce incoming arguments into expressions at the constructor level:

from sqlalchemy.sql.expression import _literal_as_column

class MyWhatever(ColumnElement):
    def __init__(self, expr, ...):
        self.expr = _literal_as_column(expr)


_literal_as_column basically calls __clause_element__() on the incoming object, and if not present tries turning it into a literal_column() if its a string. You might also try _no_literals, _only_column_elements, etc. based on what you'd expect to see there, all of which do the __clause_element__() conversion.



Thank you _literal_as_column() worked for me. This allows me to use a column from an aliased class.

--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgard...@creatureshop.com


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