Is there a way to get all the file handle IDs for a list of FileEntity IDs or do I need to load each file one at a time? Example: ``` file_ids = ['syn1', 'syn2', 'syn3'] # Instead of this: for file_id in file_ids: file_handle = syn.get(file_id).get('dataFileHandleId') # Something like this: file_handles = syn.(file_ids) ``` Can the `https://repo-prod.prod.sagebase.org/repo/v1/search` endpoint be used? Is there any documentation and examples for this endpoint?

Created by pstoutdev
+1 to what @phil said! One constraint on views is if they are being changed (e.g., a new file is uploaded within the scope, a file is altered either with a new version or change to annotations) your query will wait. The client (`syn.tableQuery`) will wait appropriately for the other operations to finish, so you don't need to handle that yourself. But to be aware of some latency that might come during queries. @pstoutdev let me know if you want to discuss the use case in more detail.
> Is the file view pretty fast to build itself for a project with tens of thousands of files? Can the view be created on the fly or is it something that should be created ahead of time (per project) and then used? File view creation is more or less instantaneous.
Most likely a file view will suit your needs best, but - depending on the size of the files you are interested in - you can speed up your for loop considerably by passing an additional parameter to syn.get: ``` file_ids = ['syn1', 'syn2', 'syn3'] for file_id in file_ids: file_handle = syn.get(file_id, downloadFile = False).get('dataFileHandleId') ``` The larger the file, the larger the speed up.
Thanks for the info I'll try out the file view. Is the file view pretty fast to build itself for a project with tens of thousands of files? Can the view be created on the fly or is it something that should be created ahead of time (per project) and then used?
Hi @pstoutdev, If you know the scope of where the files will be located (a list of containers, which could be projects or folders) you can create a [file view](https://docs.synapse.org/articles/views.html). If you add the default columns, you will get a column called `dataFileHandleId`. If the file view you create gets a Synapse ID of `syn123456`, then you can do: ```python file_ids_as_ints = [syn_id.lstrip("syn") for syn_id in file_ids] # this makes it easier to join them for the subsequent query call file_ids_for_query = ",".join(file_ids_as_ints) query = syn.tableQuery(f"SELECT dataFileHandleId FROM syn123456 WHERE id IN {file_ids_for_query}") file_handle_ids = query.asDataFrame()['dataFileHandleId'].tolist() ```
Hi pstoutdev: I am not sure if there is a better way - but you could create a [file view](https://docs.synapse.org/articles/views.html)fileView of the files and get the datafileHandleId column.

How to get dataFileHandleId in bulk for multiple files? page is loading…