I’m querying a Postgres view which returns JSON (SELECT json_build_object(…)) which I’ve declared as a view in my db:
allinfra = Table("allinfra", db.metadata, autoload_with=db.engine)
res = db.session.query(allinfra).scalar()
But this gives me a Python dict, when what I want is the JSON string returned by the view - serializing it with json.dumps() on the Python side defeats the point (getting Postgres to do the heavy lifting). Apologies if this question has an obvious answer, but I’ve found it impossible to search for.