coleifer/peewee — pull request #293 by zdxerr (2014-01-29 09:52:02+00:00)
Title: Added an itemselector for hstore fields

I added an itemgetter to the hstore field, which returns an expression the selects the corresponding key from the hstore. Now you can do stuff like:

Test.select(Test.data['key'])

and

OP_MATCH = 'match'

def match(left, right):
return Expression(left, OP_MATCH, Param(right))

PostgresqlExtDatabase.register_ops({
OP_MATCH: '~*',
})

Test.select().where(match(Test.data['key'], 'some regular expression.*'))