mark Posted January 25, 2018 Report Posted January 25, 2018 Hi, I'd like to query all components published under a certain drive letter. Is there a way to do this? My best guess at this point would be a query similar to: 'Component where component_locations.resource_identifier any (contains: "G:/")' which I realize is not syntactically correct but hopefully you get the drift... Thanks! -Mark
Lucas Correia Posted January 26, 2018 Report Posted January 26, 2018 Hi Mark, How to do this depends a bit on the location used to publish the components. Three cases are: 1. Components are published to a location representing a storage G:/ 2. Components are published to a location with a structure plugin that maps the component to different storages based on e.g. project. 3. Components are published to an location with an absolute path (e.g. ftrack.unmanaged in ftrack-python-api) For case 3, your query is almost correct. The syntax is: Component where component_locations any (resource_identifier like "G:%") Here is a an example which lists all matching components: # Query matching components, prefetching required attribtues components = session.query( 'select name, file_type, version.link from ' 'Component where component_locations any (resource_identifier like "G:%")' ) # Format link atttributes format_link = lambda entity: u' / '.join([item['name'] for item in entity['link']]) # Loop over results and print components for component in components: print u'{}: {}{}'.format( format_link(component['version']), component['name'], component['file_type'] ) Regards, Lucas
Recommended Posts
Archived
This topic is now archived and is closed to further replies.