Back

Query double(float) values error

  • 0
  • Databases
  • Functions
Zigsonn
3 Jun, 2023, 12:55

I search my problem and although there are existing posts on it i can't get to a solution.

I have a problem with querying float attributes in a python function. Here is a part of the code: print(float(long - 0.06)) print(float(lat + 0.06)) listOfExistingPoint = database.list_documents('647754cad43d1180e76f', '64789c3f1418d562efc4', [ Query.between('longitude', float(long - 0.06), float(long + 0.06)), Query.between('latitude', float(lat - 0.06), float(lat + 0.06)) ] ) the above print functions write out a float value as expected (in my case 49.94 and 50.06). At this point i am casting to float every time i use the values because i have no idea why they don't get recognized as float. Any help will be appreciated 🙂

TL;DR
The user is experiencing an issue with querying float attributes in a Python function. They are using the `between` method to query values within a specific range, but it is not working as expected. The user has tried various solutions found in similar posts but none have worked. They mention that using `greaterThan` and `lessThan` instead of `between` works. However, when they try it with the Python SDK, it doesn't work either. The user provides a sample code and mentions that the print statements correctly show float values. They ask for help in resolving the issue.
Zigsonn
3 Jun, 2023, 12:56

"here is the log:

Zigsonn
3 Jun, 2023, 12:56

49.94 50.06 Query not valid: Query type does not match expected: double

Drake
3 Jun, 2023, 14:53

I've seen something like this before but I thought we fixed this...

Zigsonn
3 Jun, 2023, 14:53

yeah i found some older posts but those that had solutions didn't help

Zigsonn
3 Jun, 2023, 14:54

appwrite version is 1.3.5 but i still created an index in case that was a problem but sadly no

Drake
3 Jun, 2023, 16:32

can you print the output of Query.between() and share it?

Drake
3 Jun, 2023, 16:39

it should be between("longitude", [50.0,50.0]). which works fine for me on 1.3.4 🧐

Drake
3 Jun, 2023, 16:48

wait..weird...it doesn't work with the python sdk..

Drake
3 Jun, 2023, 17:01

I think there's a bug with our between query. can you create an issue for this?

In the meantime, it might be best to use greaterThan and lessThan

Zigsonn
3 Jun, 2023, 17:33

sorry for late response... i will try doing those. Issui on github? or where exactly i cant remember 😅

Drake
3 Jun, 2023, 17:34

Yes, on github

Zigsonn
3 Jun, 2023, 17:34

okay will do

Zigsonn
3 Jun, 2023, 17:40

It is submitted however i had to choose that i didn't find a similar issue anywhere to be able to post, but that is not completly true, i found similar issues but the solutions did't work.

Zigsonn
3 Jun, 2023, 17:55

just to inform using greaterThan and lessThan works 🙂

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more