Hi there,
can some one help me with downloading the mPower sample data into python? I have very little SQL programming skills!
The code I am using:
``` python
import synapseclient
syn = synapseclient.Synapse()
syn.login()
entity = syn.get("syn5713119")
```
when the entity is downloaded, how should i get the whole database or one subject's data?
I have also tried the following after execution of the above code, but no progress:
``` python
results = syn.chunkedQuery("SELECT * FROM syn5713119 WHERE ROW_ID = 0")
```
regards,
saeed
Created by saeed mehrang saeed_m Hello Solveig,
I tried to download "Simple matrix example Python" data according to your guidance.
example_query = syn.tableQuery("SELECT * FROM syn10146552 LIMIT 10")
However, I get the error as below.
```
Welcome, XXX! <- I login into synapse.
Traceback (most recent call last):
File "getSynapse.py", line 8, in
entity = syn.tableQuery("SELECT * FROM syn10146552 LIMIT 10")
File "/usr/local/lib/python2.7/dist-packages/synapseclient/client.py", line 2866, in tableQuery
return CsvFileTable.from_table_query(self, query, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/synapseclient/table.py", line 1094, in from_table_query
includeRowIdAndRowVersion=includeRowIdAndRowVersion)
File "/usr/local/lib/python2.7/dist-packages/synapseclient/client.py", line 2978, in _queryTableCsv
download_from_table_result = self._waitForAsync(uri=uri, request=download_from_table_request)
File "/usr/local/lib/python2.7/dist-packages/synapseclient/client.py", line 2735, in _waitForAsync
result = self.restGET(uri+'/get/%s'%async_job_id['token'], endpoint=endpoint)
File "/usr/local/lib/python2.7/dist-packages/synapseclient/client.py", line 3383, in restGET
exceptions._raise_for_status(response, verbose=self.debug)
File "/usr/local/lib/python2.7/dist-packages/synapseclient/exceptions.py", line 140, in _raise_for_status
raise SynapseHTTPError(message, response=response)
synapseclient.exceptions.SynapseHTTPError: 403 Client Error: Forbidden
You do not have READ permission for the requested entity.
```
Could you check why this error occurs? and How can I solve this problem?
Have you tried the sample code on the mPower Challenge website? https://www.synapse.org/#!Synapse:syn8717496/wiki/448349
This explains that an appropriate query would be:
example_query = syn.tableQuery("SELECT * FROM syn10146552 LIMIT 10")
If you want the entire table, not just the top 10 rows it would be:
example_query = syn.tableQuery("SELECT * FROM syn10146552")
Drop files to upload
downloading mPower data via Python page is loading…