Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask-Restless unable to construct query

I recently using Flask-Restless to create API.

When I tried to query the API, I got "unable to construct query" error message on the web browser (firefox). Here is the query:

http://localhost:5000/api/product?q={ "filters" : [ { "name": "name", "op": "eq", "value": "mercy" } ] }

and here is the Product class:

class Product(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(80))
    details = db.Column(MutableDict.as_mutable(HSTORE))

    def __init__(self, name, details):
        self.name = name
        self.details = details

    def __repr__(self):
        return self.name

this error only occur when I used query. accessing only http://localhost:5000/api/product worked fine.

What is the problem?

I've tried to ommit the HSTORE field, but still error. So, I assume HSTORE is not the suspect.

like image 669
Kiddo Avatar asked Jun 07 '26 10:06

Kiddo


1 Answers

Try val instead of value

reference

like image 129
Thomas Avatar answered Jun 09 '26 01:06

Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!