小编Bha*_*tel的帖子

无法使用sqlachemy查询json列

我正在尝试使用PostgreSQL的json列中的查询flask-sqlalchemy。这是我的代码

house_ = House()
results = house_.query.filter(
            House.information['branch_name'].astext == 'release0'
            ).all()
Run Code Online (Sandbox Code Playgroud)

我不确定是怎么了。我尝试使用.cast(Unicode)而不是astext

出现如下错误:

NotImplementedError: Operator 'getitem' is not supported on this expression
Run Code Online (Sandbox Code Playgroud)

python postgresql sqlalchemy python-2.7 flask-sqlalchemy

1
推荐指数
1
解决办法
577
查看次数