we support this though I’m not finding a doc so easily, I believe you’d just 
index the key:   update({User.prefs[‘transitAvaiable’]: True})


On Nov 17, 2013, at 6:42 PM, Adam Tauno Williams <awill...@whitemice.org> wrote:

> Object User is mapped to a table with an HSTORE column of "prefs".
> 
> Is there a way to do an UPDATE of the column value adding a key?
> 
> Like - 
> session.query(User).\
>    filter(User.prefs.has_key('inboundBusStop')).\
>    update(
>       {User.prefs: User.prefs.update({'transitAvailable': 'true'}), }).\
>    synchronize_session('fetch')
> 
> Only that doesn't work.
> 
> This also fails
> 
> session.query(User).\
>    filter(User.prefs.has_key('inboundBusStop')).\
>    update({User.prefs: User.__table__.c.prefs + {'otherkey':
> 'fred'}, }).\
>    synchronize_session('fetch')
> 
> The catch is that I need, for the HSTORE type, to update the existing
> value, not just assign a value to it.
> 
> -- 
> Adam Tauno Williams <mailto:awill...@whitemice.org> GPG D95ED383
> Systems Administrator, Python Developer, LPI / NCLA
> 
> -- 
> 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.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to