Jump to content

KeyError for Context


tokejepsen

Recommended Posts

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?

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...