Using Custom Type With Sqlalchemy, Why Are The Results Of Process_result_value Not Transferred When Using From_statement?
I am using the custom type form this answer, which is quite similar to the one recommended in the SqlAlchemy documentation, let me reproduce it here for a self-contained question:
Solution 1:
The fix for my problem was to not rely on the textual replace *
by id
in my textual query.
It's not documented on Query.from_statement
, but I've found out that I can use it with a query that returns only the primary keys and let SqlAlchemy resolve the remaining fields.
This solves the problem because SqlAlchemy will not do the textual mapping from the result of the SQL query directly, and does the mapping correctly, at the cost of making one extra query for each resulting id.
Post a Comment for "Using Custom Type With Sqlalchemy, Why Are The Results Of Process_result_value Not Transferred When Using From_statement?"