KeyError for Context
2 2

4 posts in this topic

Hey,

I'm trying to query an asset directly under a project and get a couple of KeyError's from various attributes I would expect to be present on the project.

The full error is this "Server reported error: KeyError(u"No attribute u'root' exists for schema u'Context'.")", and the various keys I've had to exclude are;

            exclusions = [
                "full_name",
                "disk_id",
                "status",
                "project_schema_id",
            ]

Why would this be happening?

Share this post


Link to post
Share on other sites

Hey there,

not sure without actual queries/code, but i think this is the same limitation that i have hit. The reason is, that context is a dynamic (or polymorphic) entity that may be different entity types. Hence
it does not contain all the attributes that an actual instance may or may not have.

If this is what you are seeing then this was addressed in 3.3.35:

NEW

APIDeveloperAdded support for complex queries with projections and criteria containg attributes from concrete subclasses.

See also: 

http://ftrack.rtd.ftrack.com/en/latest/developing/api/query_syntax.html#developing-api-query-syntax-queries-involving-relations-to-subclasses

 

Cheers,
Thorsten

Share this post


Link to post
Share on other sites

As Thorsten mentioned this is mostly solved by the 3.3.35 release. 

The explanation for this issue is a bit technical but comes from the fact that the asset.parent relation is polymorphic, pointing to the common base class Context. Both Project and TypedContext (Shot, Task, et.c) inherits from Context and up until 3.3.35 you could not use attributes from the concrete subclasses in selection or filters when traversing such relations.

Share this post


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
2 2