Method GetDeleteRangeAsyncEnumerable
GetDeleteRangeAsyncEnumerable(String, Object, DeleteRangeOptions, CancellationToken)
Declaration
public IAsyncEnumerable<DeleteRangeResult> GetDeleteRangeAsyncEnumerable(string tableName, object partialPrimaryKey, DeleteRangeOptions options = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | The name of the table. |
Object | partialPrimaryKey | Partial primary key. Currently must be provided as MapValue representing names and values of the partial primary key fields. |
DeleteRangeOptions | options | (Optional) Options for the DeleteRange
operation. If not specified or null , appropriate defaults
will be used. See DeleteRangeOptions. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<DeleteRangeResult> | Async enumerable to iterate over DeleteRangeResult objects. |
Remarks
Use this API when the number of rows to delete is large and they cannot be deleted in one atomic operation because of the limitation on the maximum amount of data modified as specified by MaxWriteKB or the system limit.
This API is similar to
DeleteRangeAsync(String, Object, DeleteRangeOptions, CancellationToken)
but creates IAsyncEnumerable<T> that allows you to
delete range of rows in multiple successive atomic operations
using await foreach
construct, when the DeleteRange
operation cannot be performed in one atomic operation because of
the limitations discussed above. Each iteration is equivalent to
calling
DeleteRangeAsync(String, Object, DeleteRangeOptions, CancellationToken)
with a continuation key
and returns DeleteRangeResult containing the number
of deleted rows during this iteration. The quantity of rows
deleted during each iteration is thus determined in the same way
as for DeleteRangeAsync(String, Object, DeleteRangeOptions, CancellationToken),
using either MaxWriteKB or
the system default.
Note that this method itself may only throw ArgumentException. Other exceptions listed can only be thrown during the iteration process as per deferred execution semantics of enumerables.
Examples
Asynchronously iterating over GetDeleteRangeAsyncEnumerable(String, Object, DeleteRangeOptions, CancellationToken).var partialPrimaryKey =
var options = new DeleteRangeOptions
{
Compartment = "my_compartment",
FieldRange = new FieldRange("itemId")
{
StartAfter = 1000
}
};
await foreach(var result in client.GetDeleteRangeAsyncEnumerable(
"myTable", partialPrimaryKey, options))
{
Console.WriteLine($"Deleted {result.DeletedCount} row(s)");
}
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid or
partialPrimaryKey is null or invalid or
options contains invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The table or the service is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |
See Also
GetDeleteRangeAsyncEnumerable(String, Object, FieldRange, CancellationToken)
Declaration
public IAsyncEnumerable<DeleteRangeResult> GetDeleteRangeAsyncEnumerable(string tableName, object partialPrimaryKey, FieldRange fieldRange, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | The name of the table. |
Object | partialPrimaryKey | Partial primary key. Currently must be provided as MapValue representing names and values of the partial primary key fields. |
FieldRange | fieldRange | Field range for the DeleteRange operation, see FieldRange. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<DeleteRangeResult> | Async enumerable to iterate over DeleteRangeResult objects. |
Remarks
fieldRange
instead of the options
and can be used when no other options are required.
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid or
partialPrimaryKey is null or invalid or
fieldRange is invalid. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The table or the service is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |
See Also
GetDeleteRangeAsyncEnumerable(String, Object, CancellationToken)
Declaration
public IAsyncEnumerable<DeleteRangeResult> GetDeleteRangeAsyncEnumerable(string tableName, object partialPrimaryKey, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | The name of the table. |
Object | partialPrimaryKey | Partial primary key. Currently must be provided as MapValue representing names and values of the partial primary key fields. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<DeleteRangeResult> | Task returning DeleteRangeResult. |
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid or
partialPrimaryKey is null or invalid.
|
TimeoutException | Operation has timed out. |
InvalidOperationException | The table or the service is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |