I’ve been looking to make a simple typeadapter based on the HSTORE data 
type in postgres to do some value coercion and I have been having some 
problems.


I want to coerce the individual values inside my dictionary before they are 
put into the postgres HSTORE column and when I select keys, I want to 
coerce them back.


What methods do I need to subclass to intercept subkey/indexing operations 
as well as full assignment operations?


Normally for a simpler datatype I’d just implement process_bind_param, 
process_result_value but that hasn't been working the way I expect it to 
with HSTORE.


If it makes the problem simpler I don’t need the MutableExtension to work 
so I only need to coerce data on the first assignment to the column.


I'll primarily be selecting data like
    Query(MyObjectClass.MyHSTOREType['somekey'])

but occasionally, I may be doing

    Query(MyObjectClass.MyHSTOREType)

and would like my postgres->python coercion to work in both scenarios.


Thanks in advance

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

Reply via email to