How does flask SQLAlchemy limit the scope of fields to make queries?

I recently learned Flask"s SQLAlchemy,. Suppose I have such a map information table. Map has fields a, b is shaping.
I want to query the data of an and b in a specific range, such as result_query = Map.query.filter (1 .

could you tell me how to write the query statement? Baidu did not have any useful information for a long time because flask_sqlalchemy uses fewer people? If you know, let me know.


you indiscriminately tagged so that I didn't see the problem?

result_query = session.query(Map).filter(Map.a.between(1, 3), Map.b.between(3, 6))

use between.
also, I'll give you a benefit-- https://github.com/eastossifr., which is one of my projects.


result_query = session.query(Map).filter(Map.a>1).filter(Map.a<3).filter(Map.b>3).filter(Map.b<6)

try it


can also be done so that Models.field.between (1) finds that if you don't know how to search for the native method of sql, SQLAlchemy generally supports it, and feels that SQLAlchemy is closer to the native.

  • Flask query mysql

    excuse me, after flask query mysql, plus limit offset, how to determine whether the return value is found or not? r = Lines.query.filter(Lines.jp.like( %% )).limit(10).offset(10) print (r) returns sql string print (r is None) is always False print...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9cc80-1903.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9cc80-1903.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?