SQLAlchemy / psycopg2:JSONB列作为字符串而不是dicts Python返回

时间:2018-05-26 02:03:57

标签: python postgresql sqlalchemy psycopg2 jsonb

如果我有一个带有JSONB列的表,则使用SQLAlchemy引擎运行直接"执行" query(engine.execute,session.execute等)返回JSONB而不是dicts的字符串。

我使用最新的SQLAlchemy,发生了什么?

1 个答案:

答案 0 :(得分:1)

AHA!您的(我的)问题几乎肯定是由于 PSYCOPG2 问题造成的。

2.5.4之前的版本返回了JSONB列的字符串而不是dicts。

Please see this link from the psycopg2 FAQ