def get_output_files_for_output_type_and_entity(entity_id, output_type_id, representation=None): """ Get output files created for given entity and output type. """ query = OutputFile.query \ .filter(OutputFile.entity_id == entity_id) \ .filter(OutputFile.output_type_id == output_type_id) \ .order_by(desc(OutputFile.revision)) \ if representation is not None: query = query.filter(OutputFile.representation == representation) output_files = query.all() return OutputFile.serialize_list(output_files)
def get_output_files_for_output_type_and_asset_instance( asset_instance_id, temporal_entity_id, output_type_id, representation=None ): """ Get output files created for given asset instance and output type. """ query = OutputFile.query.filter( OutputFile.asset_instance_id == asset_instance_id, OutputFile.output_type_id == output_type_id, OutputFile.temporal_entity_id == temporal_entity_id, ).order_by(desc(OutputFile.revision)) if representation is not None: query = query.filter(OutputFile.representation == representation) output_files = query.all() return OutputFile.serialize_list(output_files)