【发布时间】:2016-12-22 03:36:34
【问题描述】:
我正在尝试使用flask-sqlalchemy 在 postgresql 的 json 列中进行查询。
这是我的代码
house_ = House()
results = house_.query.filter(
House.information['branch_name'].astext == 'release0'
).all()
我不确定出了什么问题。
我也尝试使用.cast(Unicode) 而不是astext。
报错如下:
NotImplementedError: Operator 'getitem' is not supported on this expression
【问题讨论】:
-
请发MCVE
-
House.information的类型是什么?如果是 JSONB,它应该可以工作
标签: python postgresql python-2.7 sqlalchemy flask-sqlalchemy