On 4/4/15 7:22 PM, Daniel Kerkow wrote:
> Hi,
> I am new to SQLAlchemy, doing my first steps with Flask.
> I have the following model using JSONB data type in PostgreSQL.
>
> The JSON data looks like
>
> |
> {'key1':'value1','key2':'value2'}
> |
>
> The Docs are relatively sparse regarding this topic.

the cases you ask for are all described at :

http://docs.sqlalchemy.org/en/rel_0_9/dialects/postgresql.html#sqlalchemy.dialects.postgresql.JSON

> How can I query the properties column for containing a specific key or
> key=value combination?

select([table]).where(table.c.col['key'] == 'somevalue')
> How can I update these?

update([table]).values({table.c.col['key'] = 'value'})

> Can I get a list of unique keys in all records?

i dunno.  Whats the Postgresql query you'd like to emit?



>
> Any help is welcome!
>
> Daniel
>
> |
> classRecord(Base):
>
>     """represents single stratigraphic units"""
>
>     # ID of corresponding site:
>     site_id        
> =db.Column(db.Integer,db.ForeignKey('public.sites.id'))
>
>     # depth values:
>     depth           =db.Column(db.Numeric,nullable=True)
>     upper_boundary  =db.Column(db.Numeric,nullable=True)
>     lower_boundary  =db.Column(db.Numeric,nullable=True)
>
>     # stratigraphic properties, represented as key/value store
>     properties      =db.Column(JSONB)
> |
>
> -- 
> 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
> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
> To post to this group, send email to sqlalchemy@googlegroups.com
> <mailto:sqlalchemy@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

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