make passing an new Activity to create_table_snapshot easier

Description

https://sagebionetworks.slack.com/archives/C0AFCTGEQ/p1613699071209700

The python client currently does not have a method to save an Activity independently of an entity, and the create_table_snapshot method takes an activity id. This means there isn't a simple way of passing a new activity to this method. Either we should have an Activity creation helper and/or accept an Activity object in that method signature.

Current workaround e.g.:
```
activity = synapseclient.Activity(
name='foo',
used=['syn123']
)

activity = syn.restPOST('/activity', body=json.dumps(activity))
syn._create_table_snapshot(table, activity=activity['id'])
```

Environment

None

Activity

Show:
Phil Snyder
February 19, 2021, 5:44 PM
Edited

This is great! Another use case: sometimes we want to reuse pre-existing Activity objects, such as when running a script with different parameterizations and storing the result to a new entity. The last time I tried to borrow an Activity from entity #1 for use with an entity #2 I was about to store elsewhere it didn’t work. IIRC this was because Activity objects are somehow dependent on the entity they are associated with and aren’t meant to be reused. I would like to see an Activity model whose objects are independent and can be swapped around like any mutable property but there are skeptics. This and its linked issue go into more detail:

Assignee

Jordan Kiang

Reporter

Jordan Kiang

Labels

None

Validator

Phil Snyder

Development Area

None

Release Version History

None

Slack Channel

None

Components

Affects versions

Priority

Major