On 6/19/14, 1:05 PM, AM wrote: > What I am storing is things like string versions of lists, tuples and > dicts, for e.g.: > > str([1, 2, 3]) > str({'a':1} > > and so on. ast.literal_eval will only parse those and return those, it > does not evaluate expressions and statements so no real code at all. > > I got around this issue by creating a PythonASTLiteralColumn based on > the example in the docs and that worked perfectly. > > Having said that I would still like to understand how to approach a > situation where I want a hybrid property that is a normal python data > type, if that's possible at all? SQLAlchemy is a bridge between Python and SQL but there is no magic in creating the thing on each side of that bridge. If you want a SQL query that interrogates a column of data in a way that is meaningful regarding some kind of in-Python behavior, you need to decide how that behavior will be expressed in your SQL query. The hybrid will work fine at the instance level but if you want it to behave meaningfully in a SQL query you'd first need to know what the SELECT statement you want will actually look like in terms of raw SQL.
-- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.