I am trying to add a feature to a web app wherein the coordinates will automatically update when a map is dragged by means of JavaScript and SQLAlchemy. But I am getting an error with my database query for the update route. Here is my query.
if sw_lng <= ne_lng:
# doesn't cross the antimeridian
rows = City.query.filter(sw_lat <= City.latitude and City.latitude <= ne_lat and (sw_lng <= City.longitude and City.longitude <= ne_lng)
).group_by(City.country_code, City.city_name, City.region
).order_by(func.random()).limit(10)
Here is the relevant error message:
raise TypeError("Boolean value of this clause is not defined")
TypeError: Boolean value of this clause is not defined
Any help will be appreciated.