Actually, this is more correct for multi-key updates:
-- select before update
SELECT id, kv->'x' AS kv_x , kv->'y' AS kv_y , kv->'z' AS kv_z FROM
test_class ;
-- update 2 columns ; these 3 are identical
---- kvkv
UPDATE test_class SET kv = kv || hstore(ARRAY['z','zz','x','xx']);
---- kv,kv
UPDATE test_class SET kv = kv || hstore(ARRAY[['z','zz'],['x','xx']]);
---- kk , vv
UPDATE test_class SET kv = kv || hstore(ARRAY['z','x'],ARRAY['zz','xx']);
-- confirm update
SELECT id, kv->'x' AS kv_x , kv->'y' AS kv_y , kv->'z' AS kv_z FROM
test_class ;
The selector syntax annoyingly flips between `=>` for insert/operations and
`->` for reading.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.