Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating an object to Azure Table Storage - is there any way to get the new Timestamp?

I'm updating an object in AzureTableStorage using the StorageClient library with

    context.UpdateObject(obj);
    context.SaveChangesWithRetries(obj);

when I do this, is there any way to get hold of the new timestamp for obj without making another request to the server?

Thanks

Stuart

like image 518
Stuart Avatar asked Mar 31 '11 12:03

Stuart


People also ask

How do you update Azure table storage?

Before updating the record, it is searched in the table using the RetrieveCustomer method by passing the partition key and row key as the parameter as we did in the previous exercise. If the entity exists, then only the update operation is done. We use TableOperation. Replace method to perform the update operation.

How do I retrieve data from Azure table storage?

Enter an Account Name, Account Key, and Table Name on the Azure Table tab of the New Session dialog. Select either HTTP or HTTPS as the connection Protocol. Ensure that the Analysis Grid viewer is selected in the Start With drop-down list. Start retrieving data by clicking the Start button in the New Session dialog.

What is the difference between Azure table storage and Cosmos DB?

Azure Table Storage supports a single region with an optional read-only secondary region for availability. Cosmos DB supports distribution from 1 to more than 30 regions with automatic failovers worldwide. You can easily manage this from the Azure portal and define the failover behavior.

Is Azure Table deprecated?

Azure. Cosmos. Table is deprecated in favor of Azure.


1 Answers

To supplement Seva Titov's answer: the excerpt reported was valid at least until May 2013, but as of November 2013 it has changed (emphasis added):

The Timestamp property is a DateTime value that is maintained on the server side to record the time an entity was last modified. The Table service uses the Timestamp property internally to provide optimistic concurrency. The value of Timestamp is a monotonically increasing value, meaning that each time the entity is modified, the value of Timestamp increases for that entity. This property should not be set on insert or update operations (the value will be ignored).

Now the Timestamp property is no longer regarded as opaque and it is documented that its value increases after each edit -- this suggests that could Timestamp could be now used to track subsequent updates (at least with regard to the single entity).

Nevertheless, as of November 2013 it is still needed another request to Table Storage to obtain the new timestamp when you update the entity (see the documentation of Update Entity REST method). Only when inserting an entity the REST service returns the entire entity with the timestamp (but I don't remember if this is exposed by the StorageClient/Windows Azure storage library).

like image 146
edymtt Avatar answered Oct 02 '22 21:10

edymtt