Jump to content

Note Component's Storage Usage


Mani Varma

Recommended Posts

Hi,

I cooked up a script to delete File Component from Note's belonging to a specific Project and has worked out fine, but it doesn't seem to reflect on Ftrack Storage Usage. Query for NoteComponent doesn't return anything anymore and I don't understand where NoteComponent get it's storage space from if it's not in Ftrack Storage.

def get_filter_string(entity_ids):
    return ', '.join(
        '"{0}"'.format(entity_id) for entity_id in entity_ids
    )
note_entities = []
project_component = session.query('select name, descendants from Project where id is "{0}"'.format(
	entity_id
)).one()
note_entities.append(project_component['id'])
for hierarchy_item in project_component['descendants']:
	note_entities.append(hierarchy_item['id'])
note_components = session.query('select component, component.file_type, component.name '
	'from NoteComponent where note.parent_id in ({0})'.format(
	get_filter_string(note_entities)
)).all()
# Download happens from note_components information then delete.
for note_component in note_components:
	session.delete(note_component['component'])

session.commit()

 

Edited by Mani Varma
Better clarity on script.
Link to comment
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...