- edited description
support MapperProperty population of text().columns() for use with query.from_statement()
I'm working on query precompilation layer and stumbled upon a bug: PickleType column does not automatically unpickle data received from the database.
[10]: m = db.session.query(Report).from_statement('SELECT * FROM reports LIMIT 1').all()
[11]: m[0].pickled_data
?}q(UurlqX634/654/aqgvppyv.jpgUserverqUcheetahUmodeqKUsizeqM?Du.
Just in case, using PostgreSQL.
Comments (6)
-
reporter -
repo owner for now you need to specify these columns using the text() approach, that is:
sess.query(Report).from_statement(text("select * from reports limit 1").columns(pickled_data=PickleType)).all()
There is a potential feature add here which I will target at 1.0, but in all likelihood this would be a 1.1 thing as 1.0 is getting pretty full. The current mechanism with from_statement() is that the SQL result from this statement is formed independently of the Query() object and any of its metadata, so it is executed using Core without any knowledge that the results will be fed into a Report object.
The feature would involve enhancing all implementations of
MapperProperty.setup_context()
to be able to add the appropriate Column objects to a given text() construct. -
repo owner - changed milestone to 1.0
- changed component to orm
- changed title to support MapperProperty population of text().columns() for use with query.from_statement()
- marked as enhancement
-
repo owner - changed milestone to 1.1
-
repo owner - changed status to duplicate
Duplicate of
#3501. -
repo owner I think what we're doing in
#3501is close enough to suit this case as well. - Log in to comment