Medienstudio.Azure.Data.Tables.Extensions 1.3.1

dotnet add package Medienstudio.Azure.Data.Tables.Extensions --version 1.3.1                
NuGet\Install-Package Medienstudio.Azure.Data.Tables.Extensions -Version 1.3.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Medienstudio.Azure.Data.Tables.Extensions" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Medienstudio.Azure.Data.Tables.Extensions --version 1.3.1                
#r "nuget: Medienstudio.Azure.Data.Tables.Extensions, 1.3.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Medienstudio.Azure.Data.Tables.Extensions as a Cake Addin
#addin nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.3.1

// Install Medienstudio.Azure.Data.Tables.Extensions as a Cake Tool
#tool nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.3.1                

Azure.Data.Tables Extensions

Extensions for the Azure.Data.Tables library to easier access & manipulate data inside Azure Table Storage.

With the CSV package you can easily import and export data from Azure Table Storage to CSV files.

NOTE

If you use this code for backups, please test both export and import functionality and verify that the data is correct. I am not responsible for any data loss.

A backup that you didn't test is not a backup.

NuGet

Nuget

Nuget

Querying

using Azure.Data.Tables;
using Medienstudio.Azure.Data.Tables.Extensions;

TableServiceClient tableServiceClient = new(connectionString);
TableClient tableClient = tableServiceClient.GetTableClient("tablename");

// Get all rows from the table
List<TableEntity> entities = await tableClient.GetAllEntitiesAsync<TableEntity>();  

// Get all rows by PartitionKey
List<TableEntity> entities = await tableClient.GetAllEntitiesByPartitionKeyAsync<TableEntity>("MyPartitionKey");

// Get all rows by RowKey
List<TableEntity> entities = await tableClient.GetAllEntitiesByRowKeyAsync<TableEntity>("MyRowKey");

// Get all entites where a column starts with a specific value
List<TableEntity> entities = await _tableClient.GetAllEntitiesStartingWithAsync<TableEntity>("MyColumn", "abc");

// Get first entity in table (smallest PartitionKey + RowKey)
TableEntity entity = await tableClient.GetFirstEntityAsync<TableEntity>();

// Add list of entites (with auto-batching)
List<TableEntity> entities = new(){...};
await tableClient.AddEntitiesAsync(entities);

// Delete all rows from the table
await tableClient.DeleteAllEntitiesAsync();

// Delete all rows by PartitionKey
await _tableClient.DeleteAllEntitiesByPartitionKeyAsync("123");

// Create a table if it does not exists without throwing a hidden Exception that Application Insights will track
await tableServiceClient.CreateTableIfNotExistsSafeAsync(tableName);

CSV Export / Import

The CSV package aims support Azure Table Storage data import & export support for CSV exactly as the Azure Storage Explorer and the old Azure CLI v7 does it. Therefore exported files should be importable by the Azure Storage Explorer and the package can also read exports from ASE.

using Azure.Data.Tables;
using Medienstudio.Azure.Data.Tables.CSV;

TableServiceClient tableServiceClient = new(connectionString);
TableClient tableClient = tableServiceClient.GetTableClient("tablename");

// Export all rows from the table to a CSV file
using StreamWriter writer = File.CreateText("test.csv");
await _tableClient.ExportCSVAsync(writer);

// Export all rows as CSV to Azure BLob Storage
BlobContainerClient containerClient = new(BlobConnectionString, "testcontainer");
var blobClient = containerClient.GetBlobClient("test.csv");
var stream = await blobClient.OpenWriteAsync(true, new BlobOpenWriteOptions() { HttpHeaders = new BlobHttpHeaders { ContentType = "text/csv" } });
using StreamWriter writer = new(stream);
await _tableClient.ExportCSVAsync(writer);

// Import all rows from a CSV file to the table
using StreamReader reader = new("test.csv");
await _tableClient.ImportCSVAsync(reader);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Medienstudio.Azure.Data.Tables.Extensions:

Package Downloads
Medienstudio.Azure.Data.Tables.CSV

An Azure.Data.Tables extension package for exporting Azure Tables as CSV for backup purposes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 63,786 3/13/2024
1.3.0 2,736 12/20/2023
1.2.0 30,356 2/17/2023
1.1.2 270 2/17/2023
1.1.1 1,015 1/18/2023
1.1.0 322 1/11/2023
1.0.10 8,646 4/14/2022
1.0.9 450 3/30/2022
1.0.8 440 3/29/2022
1.0.7 461 3/28/2022
1.0.6 432 3/26/2022
1.0.5 537 1/20/2022
1.0.4 437 1/20/2022
1.0.3 434 1/18/2022
1.0.2 448 1/18/2022
1.0.1 427 1/18/2022
1.0.0 485 1/17/2022

Added: Safe Key Helper