Azure Storage Explorer Query where by Timestamp
Asked Answered
C

6

18

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.

Committee answered 23/4, 2014 at 9:47 Comment(0)
V
20

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'

Veratrine answered 24/4, 2014 at 17:42 Comment(1)
how can i get the latest record?Clerihew
O
3

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);
Octonary answered 7/3, 2019 at 2:21 Comment(0)
N
2

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.

Nosey answered 9/2, 2016 at 15:28 Comment(0)
F
1

This should work

Timestamp ge datetime'2013-10-06T00:00:00'

Folkways answered 8/5, 2015 at 21:3 Comment(0)
T
0

If you want to filter the query in the date range use:

Timestamp ge datetime'2017-07-21T20:07:35.000Z' and Timestamp lt datetime'2017-07-24T20:07:35.000Z'
Tallow answered 25/7, 2017 at 7:40 Comment(0)
C
0

its old but I got this working like this.

Timestamp ge datetime'2020-10-06T00:00:00'
Cinderellacindi answered 31/3, 2021 at 13:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.