Hi,
I'm new to Synapse so my apologies in advance for any trivial questions. I have use case where I must enumerate all tables (and their schemas) and subsequently download them. My questions are:
1. How can I enumerate all current tables within Synapse? It appears that to access the tables, I must know their synapse ID. The search bar on Synapse's website UI does not allow to filter for projects that contain projects.
2. What's the best approach to download the tables? There doesn't appear to be a way to dump all tables at once. Instead, would the approach be to download each table individually once I have a list of synapse IDs for those that are available?
Thank you!
Created by Calvin nguyen cnguyen Hi,
Thanks for the replies! My apologies for being unclear in my question at first. I am looking to enumerate all tables for a given project (and would like to do this for all projects I have access to).
A follow-up question I have is regarding data consistency since the tables must be downloaded in a singe instance. Is there a way to obtain a snapshot of the table? Hi Calvin:
Actually this is supported through the APIs. You can enumerate all tables in project using queries (see [docs](http://docs.synapse.org/articles/annotation_and_query.html)). For example in Python to get all tables in the project with synapseId syn123 you would do:
```
import synapseclient
syn = synapseclient.login()
tableIds = syn.query('select id from table where projectId=="syn123"')
```
You can then batch get the schemas with:
```
schemas = [syn.get(i['table.id']) for i in tableIds['results']]
```
The missing component is getting all the projects you have access to. This is supported with a REST call [/entity/children](http://docs.synapse.org/rest/POST/entity/children.html). There is a convenience function in the python client called `syn.getChildren` but it did not work for projects (it has been fixed and will be available in a future release.) Hi Calvin,
You are correct, this isn't yet supported through the UI. Additionally, Tables aren't (yet) indexed for search outside of their parent projects, so sadly I'm not sure we have a solution for you at this time. Can you tell me a little bit more about your goals here? We may be able to suggest a workaround.
Best,
Meredith
P.S. Your best bet for bulk downloading tables is to use the list of tables you want and kick off a download using one of our programmatic clients (R or Python). There's no mechanism to dump all tables at once, for performance reasons (there are many, many tables and some of them are quite large, so attempting to download ALL of them would be very very slow for you if you tried to do them all at once).