You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How can I query key's value in a text column from my table? #4739
datatypesthings to do with database types, like VARCHAR and othersmysqlquestionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question
Hi,all.
There is a problem that has bothered me in recent days. I designed an org_score table using the MySql 5.7 database. In the table I designed "range" column of text type, using json string to store time.
The contents of this field are as follows:
{“timeStart”:"2017-01-01","timeEnd":"2017-02-01"}
I can use the sql of SELECT * FROM org_score WHERE range->'$.timeStart' >= '2017-01-01';
This way I can directly query the timeStart key under range. But I don't know how to use the ORM, statement of flask-sqlalchemy. Go check this result.
datatypesthings to do with database types, like VARCHAR and othersmysqlquestionissue where a "fix" on the SQLAlchemy side is unlikely, hence more of a usage question
Activity
zzzeek commentedon Jun 25, 2019
MySQL uses a function JSON_EXTRACT to extract elements from a JSON structure, SQLAlchemy renders this when you use the brackets operator:
https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqlalchemy.types.JSON
zzzeek commentedon Jun 25, 2019
with literal binds:
the "->" thing is a synonym for json_extract
zzzeek commentedon Jun 28, 2019
no activity here, closing
SuFIND commentedon Aug 26, 2019
Thanks!