it's my first time working with Azure Storage Explorer and I need to read some logs that is save into Azure Tables. The version of mine is 4
I read this reference http://msdn.microsoft.com/library/azure/ff683669.aspx but there is not explanation to work with the column Timestamp.
Basically, I want to see logs since a specific date.
I tried query like;
Timestamp ge '4/10/2013'
Timestamp ge 4/10/2013
Timestamp gt '4/10/2013'
Timestamp gt 4/10/2013
And the result is only a error message.
An error occurred while processing this request.
It looks like you would need to use something like below in order to filter on a Timestamp. Please look at Filtering on DateTime Properties here.
Timestamp ge datetime'2008-07-10T00:00:00Z'
Use TableQuery.GenerateFilterConditionForDate()
methods to set datetime based query parameters against Azure table storage tables:
using Microsoft.WindowsAzure.Storage.Table;
// Input parameters to your method, etc:
DateTimeOffset from;
DateTimeOffset until;
string DateFromFilter = TableQuery.GenerateFilterConditionForDate("Date", QueryComparisons.GreaterThanOrEqual, from);
string DateUntilFilter = TableQuery.GenerateFilterConditionForDate("Date", QueryComparisons.LessThanOrEqual, until);
finalFilter
is just a string which you build up using TableQuery methods such as CombineFilters()
:
finalFilter = TableQuery.CombineFilters(finalFilter, TableOperators.And, DateFromFilter);
finalFilter = TableQuery.CombineFilters(finalFilter, TableOperators.And, DateUntilFilter);
TableQuery<MyAzureObject> query = new TableQuery<MyAzureObject>().Where(finalFilter);
This is how you could do it:
var dateFilter = "(PartitionKey ge '0" + StartTime.Ticks + "')" + "and (PartitionKey le '0" + EndTime.Ticks + "')";
StartTime
and EndTime
will be your date range. Remember that you can only query over PartitionKey because it has index.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With