| Philip - does this help you at all ? I used the ORM to access the connection and table data in the underlying engine.
Thank you for your help guys, it was very helpful! HSTORE updating does work nicely; I've ended up using events as Michael suggested, except that I have hooked into the insert/update events instead of the validation. Since my values are often not strings on the python side I have to CAST() them to strings before putting them in the hstore as values. And it is very nice for them to be strings that postgres itself can cast back to types like dates/times etc.. so I can filter nicely server-side (another great side effect of using column_property) I spent many hours trying to work out how to get sqlalchemy/psycopg2 to do the equivalent of: session.execute(select([cast(my_data, String)])).scalar() Without actually querying the DB or enumerating the types and their conversions myself which seems a bit naff; psycopg2.extensions.adapt almost does it but not quite (e.g. you get "'2013-09-10'::date" when CAST() gives you "2013-09-10"). Any ideas? It's not vital, I don't do much up dating of these guys really so I have it doing a supplemental SQL query like the one above for every update/insert :) I have actually taken it one step further, and allowed for JSON encoded data to be a value type in the hstore too, and with a modified version of the Mutable extension everything actually works as you would expect. As in, I have a mapped mutable attribute on my class which maps to an arbitary JSON object whose text resides in the VALUE of a postgres HSTORE. I had to make some modifications to ext.Mutable so that it supports the notion of something *optionally* being a mutable type. E.g. when I decode my JSON string, I don't know whether or not it is going to be a dictionary or an integer. If anyone is interested I can post the code, it is based on this idea: https://gist.github.com/dbarnett/1730610 Thanks again; and keep up the great work - I love SQLAlchemy! Philip -- 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/groups/opt_out.