Name of the table to perform operations on.
Table Account URL
Insert entity in the table.
The properties for the table entity.
Creates a table with the tableName passed to the client constructor
Deletes the specified entity in the table.
The partition key of the entity.
The row key of the entity.
Permanently deletes the current table with all of its entities.
Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures.
Returns a single entity in the table.
The partition key of the entity.
The row key of the entity.
Queries entities in a table.
Optionaloptions: ListTableEntitiesOptionsThe options parameters.
Example listing entities
import { DefaultAzureCredential } from "@azure/identity";
import { TableClient } from "@azure/data-tables";
const account = "<account>";
const accountKey = "<accountkey>";
const tableName = "<tableName>";
const credential = new DefaultAzureCredential();
const client = new TableClient(`https://${account}.table.core.windows.net`, tableName, credential);
let i = 0;
const entities = client.listEntities();
for await (const entity of entities) {
console.log(`Entity${++i}: PartitionKey: ${entity.partitionKey} RowKey: ${entity.rowKey}`);
}
Sets stored access policies for the table that may be used with Shared Access Signatures.
Submits a Transaction which is composed of a set of actions. You can provide the actions as a list or you can use TableTransaction to help building the transaction.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { TableClient, TransactionAction } from "@azure/data-tables";
const account = "<account>";
const accountKey = "<accountkey>";
const tableName = "<tableName>";
const credential = new DefaultAzureCredential();
const client = new TableClient(`https://${account}.table.core.windows.net`, tableName, credential);
const actions: TransactionAction[] = [
["create", { partitionKey: "p1", rowKey: "1", data: "test1" }],
["delete", { partitionKey: "p1", rowKey: "2" }],
["update", { partitionKey: "p1", rowKey: "3", data: "newTest" }, "Merge"],
];
const result = await client.submitTransaction(actions);
Example usage with TableTransaction:
import { DefaultAzureCredential } from "@azure/identity";
import { TableClient, TableTransaction } from "@azure/data-tables";
const account = "<account>";
const accountKey = "<accountkey>";
const tableName = "<tableName>";
const credential = new DefaultAzureCredential();
const client = new TableClient(`https://${account}.table.core.windows.net`, tableName, credential);
const transaction = new TableTransaction();
// Call the available action in the TableTransaction object
transaction.createEntity({ partitionKey: "p1", rowKey: "1", data: "test1" });
transaction.deleteEntity("p1", "2");
transaction.updateEntity({ partitionKey: "p1", rowKey: "3", data: "newTest" }, "Merge");
// submitTransaction with the actions list on the transaction.
const result = await client.submitTransaction(transaction.actions);
Update an entity in the table.
The properties of the entity to be updated.
The different modes for updating the entity: - Merge: Updates an entity by updating the entity's properties without replacing the existing entity. - Replace: Updates an existing entity by replacing the entire entity.
Upsert an entity in the table.
The properties for the table entity.
The different modes for updating the entity: - Merge: Updates an entity by updating the entity's properties without replacing the existing entity. - Replace: Updates an existing entity by replacing the entire entity.
An in-memory mock of the Azure TableClient. It uses a Map to simulate table storage and correctly implements the TableClient interface.
Example