Nebukadhezer Posted April 3, 2017 Report Posted April 3, 2017 I was wondering if a query with projections, that contains values from a projected entity like task.name, context.name, status.name should be included in the encoded version of that data ? Via session.encode(queryResult) ? Was thinking to use this to store those on QtUserRoles as the ftrack_api objects wont work there... but I would then love to have the projected values in there.... Cheers Johannes
Mattias Lagergren Posted April 4, 2017 Report Posted April 4, 2017 I'd like to suggest I different solution - not sure exactly your use-case: Use the session's built in memory cache and store the identity of the object: import ftrack_api.inspection >>> ftrack_api.inspection.identity(task) ('Task', ['00a574b0-1c44-11e2-a9da-f23c91df25eb']) >>> entity_type, primary_keys = ftrack_api.inspection.identity(task) And then associate entity_type and primary_keys with the QtUserRoles. Then, later, you can get the cached entity from the same session (no server requests involved since identity is already in the identity map): >>> session.get(entity_type, primary_keys) <dynamic ftrack Task object 4550792272>
Nebukadhezer Posted April 4, 2017 Author Report Posted April 4, 2017 Hi Mattias, I ll give this a shot, nevertheless, would you also say nested projections like entity.attribute should be serialized in encode ? Cheers Johannes
Mattias Lagergren Posted April 5, 2017 Report Posted April 5, 2017 Quote would you also say nested projections like entity.attribute should be serialized in encode No, collection projections are not fully serialised using encode. They are serialised only with entity type and primary keys.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.