Hi There,
I have two questions regarding tables data in synapse.
I understand two variables i.e. the row id and row version captures the updates and new additions of rows in tables.
So when I update a particular row data using row id and version, only the version gets changed after that; of course along with overwriting of the fields that we changed.
- My question is that If I ever need to fetch the the old version of the row how can I do it? For example from the image below (that is snapshot from R client based synapse table tutorial [weblink](https://r-docs.synapse.org/articles/tables.html#changing-data)) if I wanted to fetch an earlier version (say 1) of the rows marked version 3 with red ovals how can I do that. I am sorry but I could not figure it out.
${imageLink?synapseId=syn23585170&align=None&scale=55&responsive=true&altText=}
- my question 2 is that can we take snapshot versions of tables (like full tables) too like other entities ? which I have tried to find out too and the answer is probably No ! but just wanted to verify with you.
Thanks much,
Amnah
Created by amnah siddiqa amnah Thank you so much @brucehoff . This was exactly I needed. I saw that I could create a snapshot from web but could not find the syntax in R.
Appreciate it.
Hi, your questions are interrelated: To reference an older version of a table you can take snapshots when it suits you, then reference those snapshots. To create a snapshot you can use this API:
https://rest-docs.synapse.org/rest/POST/entity/id/table/snapshot.html
In R you would use `synRestPOST`, e.g.
```
response<-synRestPOST(sprintf("/entity/%s/table/snapshot", tableId), toJSON(list(snapshotLabel="my label")))
snapshotVersionNumber<-fromJSON(response)$snapshotVersionNumber
```
Then you reference the snapshot in your query:
```
synTableQuery(sprintf("select * from %s.%s limit 10", tableId, snapshotVersionNumber))
```