Hello all: # TL;DR I have a question regarding how to use the Synapse API/Client to query all projects that have been shared with a particular Team account. # Background I am part of a consortium of organizations that each own their own set of data assets (VCF, BAM, etc). Along with these "data" assets are metadata tables that describe other attributes of research subjects (disease history and symptomology, medication histories and outcomes, lab results, etc) and include links to which data assets belong to which subject mentioned in the metadata tables. Assume that each Consortium member-site has its own Synapse Projects that are all shared with a Consortium "Team". Further assume that the metadata is in a form that can be easily combined with each of the other sites' metadata tables to form a relational database for the whole consortium and that each file representing the metadata tables gets a boolean `is_db` tag upon upload/update.   The ultimate goal is to have a member-site pull down the metadata tables from all sites, construct the most up-to-date relational database and be able to query it using complex relational query logic that doesn't "seem" to be available through the standard single table select queries supported by the API. # Question Is there a way to do something analogous to: ``` select * from file where file.team_id=='xxxx' and file.is_db==True ``` to search across all projects that are shared with a certain Team?

Created by Gus Dunn gusdunn
Thanks @larssono: I will take a look into both of these. Gus
@gusdunn This is an excellent question. I had to get some help to figure this one out. We don't have any convenient query functionality to do what you want but you can get at the same information by making a rest call. Specifically you can find out all the projects that have been shared with specific team then you can run queries on those projects. I will admit this will miss files that have been explicitly shared with a team when the project itself has not. If this gets you close enough here is an example: Lets assume you are interested in the ${badge?isUser=false&id=3320424} team which has team id 3320424. To get the list of projects explicitly shared with this team call (this example is using the python client, R or java would be similar): ``` projects = syn.restGET('/projects/TEAM_PROJECTS/team/3320424') ``` This will return: ``` {u'results': [{u'id': u'syn2580853', u'lastActivity': u'2017-03-14T05:59:21.000Z', u'modifiedBy': 372127, u'modifiedOn': u'2017-03-14T05:59:20.747Z', u'name': u'AMP AD Knowledge Portal'}, ...... {u'id': u'syn4907617', u'lastActivity': u'2015-10-21T17:41:55.495Z', u'modifiedBy': 274008, u'modifiedOn': u'2015-08-26T17:02:18.838Z', u'name': u'AMP-AD Cross Network Comparison'}], u'totalNumberOfResults': 11} ``` It also sounds like you might want to merge the metadata across multiple projects. We recently released the ability to create views of the metadata spanning multiple projects so that you can query across projects. See > **http://docs.synapse.org/articles/fileviews.html**

Suggested design pattern(s) for querying all projects shared with a "team"? page is loading…