【问题标题】:Flask-Restless unable to construct queryFlask-Restless 无法构造查询
【发布时间】:2013-01-22 15:26:51
【问题描述】:

我最近使用 Flask-Restless 创建 API。

当我尝试查询 API 时,我在网络浏览器 (firefox) 上收到“无法构造查询”错误消息。这是查询:

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

这是 Product 类:

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

此错误仅在我使用查询时发生。仅访问 http://localhost:5000/api/product 工作正常。

有什么问题?

我尝试省略 HSTORE 字段,但仍然出错。所以,我认为 HSTORE 不是嫌疑人。

【问题讨论】:

    标签: python flask-restless


    【解决方案1】:

    尝试val 而不是value

    reference

    【讨论】:

    • 真可惜...我在文档中没有注意到它。
    猜你喜欢
    • 2018-03-02
    • 2023-03-13
    • 2019-07-15
    • 2018-08-15
    • 2016-09-10
    • 1970-01-01
    • 2013-10-16
    • 2015-09-20
    • 2014-04-05
    相关资源
    最近更新 更多