Created
April 5, 2017 13:21
-
-
Save rectalogic/abe064946289d2917e970c37ad95a726 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import sqlalchemy as sa | |
>>> from cureatr.model import sql | |
>>> t = sa.Table( | |
... "cureatr.user_messages", sql.rds_metadata, | |
... sa.Column("_id", sql.ObjectIdType, primary_key=True), | |
... sa.Column("document", sa.dialects.postgresql.JSONB)) | |
>>> message_id = t.c.document['message_id'].label("message_id") | |
>>> iid = t.c.document['iid'].label("iid") | |
>>> q = sa.select([message_id, iid]) | |
>>> r = sql.rds_engine.engine.execute(q) | |
>>> f = r.first() | |
>>> f | |
(ObjectId('51b8ad2b51c356298207f95a'), u'cureatr') | |
>>> f[message_id] | |
ObjectId('51b8ad2b51c356298207f95a') | |
>>> f[iid] | |
u'cureatr' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment