Jump to content

How to query custom attributes ?


deex

Recommended Posts

Hello,

 

I have added custom attributes to shots.

When i do a query like this :

tasks = session.query(                          'Shot where name is {0} and '                          'parent.name is {1} and '                          'project.name is {2} '                          .format(shotName,                                  sequenceName,                                  projectName                                  )                          )

My custom attributes are not here. How can i do this please ?

Link to comment
Share on other sites

Doesn't work :

 

session = ftrack_api.Session()    shots = session.query(                          #=====================================================                          # 'select fstart, fend, duration, startHandles, endHandles, fsequenceend, fsequencestart '                          #=====================================================                          'Shot where name is {0} and '                          'parent.name is {1} and '                          'project.name is {2} '                          .format(shotName,                                  sequenceName,                                  projectName                                  )                          )    for i in shots:        print i.keys()        print i['custom_attributes']
    print i['custom_attributes']  File "C:\Python27\lib\site-packages\ftrack_api\entity\base.py", line 167, in __getitem__    raise KeyError(key)KeyError: 'custom_attributes'
 
Link to comment
Share on other sites

  • 5 weeks later...
  • 2 weeks later...

Hi,

 

Code example :

import ftrack_apisession = ftrack_api.Session()projects = session.query(                         'Project where status is active and '                         '(full_name like "ftrack test")')tasks = session.query('Task where project.id is "{0}"'.format(projects[0]['id'])).all()for task in tasks:    customAttr = task['custom_attributes']    print customAttr.keys()    for attr in customAttr:        print attr.keys()

The project :

1449085546-2015-12-02-114403.png

 

Custom attribute (some are hierarchical) :

1449085550-2015-12-02-114438.png

 

Code result :

[][][][][][][][][][][][][][][]

Expected result :

Something not empty.

 

Hey,

 

Could you provide some more information, such as:

 

* Code example

* Information about the project structure and custom attributes you are using

* Expected result

 

 

More information here:

http://ftrack-python-api.rtd.ftrack.com/en/latest/example/custom_attribute.html

Link to comment
Share on other sites

Hi deex,

 

I noticed that you are querying for tasks but the screenshot you shared is showing a Sequence.  Do you have custom attributes on the tasks as well, other than hierarchical?

 

Accessing hierarchical attributes are not supported at present:

http://ftrack-python-api.rtd.ftrack.com/en/latest/example/custom_attribute.html#hierarchical-attributes

Link to comment
Share on other sites

Ah, all my custom attributes are hierarchical. It is why it doesn't work.

 

Hi deex,

 

I noticed that you are querying for tasks but the screenshot you shared is showing a Sequence.  Do you have custom attributes on the tasks as well, other than hierarchical?

 

Accessing hierarchical attributes are not supported at present:

http://ftrack-python-api.rtd.ftrack.com/en/latest/example/custom_attribute.html#hierarchical-attributes

Link to comment
Share on other sites

  • 1 year later...
On 17/02/2017 at 4:56 PM, Nebukadhezer said:

is there news on this topic ?
From the docs it reads as though it was possible, only I need to loop through all parents myself, But I cannot even see hierarchical  attr in the custom attributes keys ...

No news at the moment. On your custom attribute configuration there should be a `is_hierarchical` to indicate if it is a an hierarchical attribute..

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...