Medienstudio.Azure.Data.Tables.Extensions
1.4.1
dotnet add package Medienstudio.Azure.Data.Tables.Extensions --version 1.4.1
NuGet\Install-Package Medienstudio.Azure.Data.Tables.Extensions -Version 1.4.1
<PackageReference Include="Medienstudio.Azure.Data.Tables.Extensions" Version="1.4.1" />
<PackageVersion Include="Medienstudio.Azure.Data.Tables.Extensions" Version="1.4.1" />
<PackageReference Include="Medienstudio.Azure.Data.Tables.Extensions" />
paket add Medienstudio.Azure.Data.Tables.Extensions --version 1.4.1
#r "nuget: Medienstudio.Azure.Data.Tables.Extensions, 1.4.1"
#addin nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.4.1
#tool nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.4.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
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);
// Count all rows in the table
int count = await _tableClient.CountEntitiesAsync();
// Count all rows by PartitionKey
int count2 = await _tableClient.CountEntitiesAsync(partitionKey: "MyPartitionKey");
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Azure.Data.Tables (>= 12.10.0)
- System.Linq.Async (>= 6.0.1)
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.4.1 | 516 | a month ago |
1.4.0 | 188 | a month ago |
1.3.1 | 78,335 | 3/13/2024 |
1.3.0 | 3,683 | 12/20/2023 |
1.2.0 | 38,516 | 2/17/2023 |
1.1.2 | 286 | 2/17/2023 |
1.1.1 | 1,040 | 1/18/2023 |
1.1.0 | 342 | 1/11/2023 |
1.0.10 | 8,930 | 4/14/2022 |
1.0.9 | 475 | 3/30/2022 |
1.0.8 | 465 | 3/29/2022 |
1.0.7 | 487 | 3/28/2022 |
1.0.6 | 458 | 3/26/2022 |
1.0.5 | 564 | 1/20/2022 |
1.0.4 | 463 | 1/20/2022 |
1.0.3 | 461 | 1/18/2022 |
1.0.2 | 475 | 1/18/2022 |
1.0.1 | 456 | 1/18/2022 |
1.0.0 | 530 | 1/17/2022 |
Added: Safe Key Helper