Skip to content

Commit 2ab4d5f

Browse files
authored
Patch table and file versioning tutorial updates (#1172)
* Patch table and file versioning tutorial updates
1 parent 3690a2a commit 2ab4d5f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

docs/tutorials/file_versioning.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Explicit example:
1111
```python
1212
import synapseclient
1313

14+
syn = synapseclient.login()
15+
1416
# fetch the file in Synapse
1517
file_to_update = syn.get('syn2222', downloadFile=False)
1618

@@ -58,14 +60,17 @@ file = syn.store(file, forceVersion=False)
5860
To set Provenance without changing the file version:
5961

6062
```python
63+
from synapseclient import Activity
64+
6165
# Get file from Synapse, set download=False since we are only updating provenance
6266
file = syn.get('syn56789', download=False)
6367

64-
# Add provenance
65-
file = syn.setProvenance(file, activity = Activity(used = '/path/to/example_code'))
66-
67-
# Store the file without creating a new version
68-
file = syn.store(file, forceVersion=False)
68+
# Add provenance (passing in activity) and store the file without creating a new version
69+
file = syn.store(
70+
file,
71+
activity = Activity(used = 'some_valid_file_synapse_id'),
72+
forceVersion=False
73+
)
6974
```
7075

7176
## Downloading a Specific Version

docs/tutorials/tables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ The `Table` function takes two arguments, a schema object and data in some form,
7171
With a bit of luck, we now have a table populated with data. Let's try to query:
7272

7373
```python
74-
results = syn.tableQuery("select * from %s where Chromosome='1' and Start < 41000 and End > 20000"
75-
% table.schema.id)
74+
results = syn.tableQuery(
75+
f"SELECT * FROM {table.schema.id} WHERE Chromosome = '1' AND Start < 41000 AND \"End\" > 20000")
7676
for row in results:
7777
print(row)
7878
```

0 commit comments

Comments
 (0)