Jump to content

Should projections be encoded/serialized


Recommended Posts

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

 

Link to post
Share on other sites

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>

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...