Lightweight F# extension for the latest Azure.Data.Tables SDK
If you want to install this package manually, use usual NuGet package command
Install-Package Tables.FSharp
or using Paket
paket add Tables.FSharp
New SDK API provides two methods on TableClient
for querying - Query
and QueryAsync
. Both methods expects filter query in OData standard which can be tedious and error-prone work. Consider this:
open Azure.Data.Tables
let tableClient = TableClient("connString", "MyTable")
let manualQuery = sprintf "(StringValue eq '%s') or not ((DateValue ge datetime'%s') and IntValue lt %i)" roman (DateTimeOffset.UtcNow.ToString("o")) 42
let results = table.Query<MyEntity>(manualQuery)
Using this library, new overloads of Query
and QueryAsync
are available to accept Filter
value instead of query string. This Filter
is transformed into valid and supported OData format, including date conversions and correct data formatting:
open Azure.Data.Tables
open Azure.Data.Tables.FSharp
let tableClient = TableClient("connString", "MyTable")
let results =
(eq "StringValue" "Roman" * !! (ge "DateValue" DateTimeOffset.Now + lt "IntValue" 42))
|> tableClient.Query<MyEntity>
To inspect transformed output of Filter
value you can use FilterConverter
module:
open Azure.Data.Tables.FSharp
let oDataString =
(eq "StringValue" "Roman" * !! (ge "DateValue" DateTimeOffset.Now + lt "IntValue" 42))
|> FilterConverter.toQuery
If you need to comfortably pass more arguments into Query
/ QueryAsync
like columns selection or paging, the computation expression tableQuery
is here for you:
tableQuery {
filter (eq "GuidVal" Guid.Empty)
select [ "ColumnOne"; "ColumnTwo" ]
maxPerPage 5 // take only 5 rows per page
} |> tableClient.Query<MyEntity>
Azure.Data.Tables
is currently in beta3 and first API looks quite promising - maybe no wrapper around that won't be necessary at all. See the examples. I'll keep monitoring progress and will add more wrappers if needed.