DeleteRequest¶
- class borneo.DeleteRequest[source]¶
Bases:
WriteRequestRepresents the input to a
NoSQLHandle.delete()operation.- This request can be used to perform unconditional and conditional deletes:
Delete any existing row. This is the default.
Succeed only if the row exists and and its
Versionmatches a specificVersion. Useset_match_version()for this case. Using this option in conjunction with usingset_return_row()allows information about the existing row to be returned if the operation fails because of a version mismatch. On success no information is returned.
Using
set_return_row()may incur additional cost and affect operation latency.The table name and key are required parameters. On a successful operation
DeleteResult.get_success()returns True. Additional information, such as previous row information, may be available inDeleteResult.Methods Summary
Get the compartment id or name if set for the request.
Gets the durability to use for the operation or None if not set.
get_key()Returns the key of the row to be deleted.
Returns the
Versionused for a match on a conditional delete.Returns whether information about the existing row should be returned on failure because of a version mismatch.
Returns the table name to use for the operation.
Returns the timeout to use for the operation, in milliseconds.
set_compartment(compartment)Sets the name or id of a compartment to be used for this operation.
set_durability(durability)Sets the durability to use for the operation.
set_key(key)Sets the key to use for the delete operation.
set_key_from_json(json_key)Sets the key to use for the delete operation based on a JSON string.
set_match_version(version)Sets the
Versionto use for a conditional delete operation.set_return_row(return_row)Sets whether information about the existing row should be returned.
set_table_name(table_name)Sets the table name to use for the operation.
set_timeout(timeout_ms)Sets the optional request timeout value, in milliseconds.
Methods Documentation
- get_compartment()¶
Get the compartment id or name if set for the request.
Cloud service only.
- Returns:
compartment id or name if set for the request, otherwise None if not set.
- Return type:
str
- get_durability()[source]¶
Gets the durability to use for the operation or None if not set.
On-premises only :returns: the Durability :versionadded:: 5.3.0
- get_key()[source]¶
Returns the key of the row to be deleted.
- Returns:
the key value, or None if not set.
- Return type:
dict
- get_match_version()[source]¶
Returns the
Versionused for a match on a conditional delete.- Returns:
the Version or None if not set.
- Return type:
- get_return_row()[source]¶
Returns whether information about the existing row should be returned on failure because of a version mismatch.
- Returns:
True if information should be returned.
- Return type:
bool
- get_table_name()¶
Returns the table name to use for the operation.
- Returns:
the table name, or None if not set.
- Returns:
str
- get_timeout()[source]¶
Returns the timeout to use for the operation, in milliseconds. A value of 0 indicates that the timeout has not been set.
- Returns:
the timeout value.
- Return type:
int
- set_compartment(compartment)[source]¶
Sets the name or id of a compartment to be used for this operation.
The compartment may be specified as either a name (or path for nested compartments) or as an id (OCID). A name (vs id) can only be used when authenticated using a specific user identity. It is not available if authenticated as an Instance Principal which can be done when calling the service from a compute instance in the Oracle Cloud Infrastructure. See
borneo.iam.SignatureProvider.create_with_instance_principal().Cloud service only.
- Parameters:
compartment (str) – the compartment name or id. If using a nested compartment, specify the full compartment path compartmentA.compartmentB, but exclude the name of the root compartment (tenant).
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if compartment is not a str.
- set_durability(durability)[source]¶
Sets the durability to use for the operation.
On-premises only
- Parameters:
durability (Durability) – the Durability to use
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if Durability is not valid
- Versionadded::
5.3.0
- set_key(key)[source]¶
Sets the key to use for the delete operation. This is a required field.
- Parameters:
key (dict) – the key value.
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if key is not a dictionary.
- set_key_from_json(json_key)[source]¶
Sets the key to use for the delete operation based on a JSON string. The string is parsed for validity and stored internally as a dict.
- Parameters:
json_key (str) – the key as a JSON string.
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if json_key is not a string.
- set_match_version(version)[source]¶
Sets the
Versionto use for a conditional delete operation. The Version is usually obtained fromGetResult.get_version()or other method that returns a Version. When set, the delete operation will succeed only if the row exists and its Version matches the one specified. Using this option will incur additional cost.- Parameters:
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if version is not an instance of Version.
- set_return_row(return_row)[source]¶
Sets whether information about the existing row should be returned. If set to true existing row information is returned if one of the following occurs:
PutOption.IF_VERSION is used and the operation fails because the row exists and its version does not match.
PutOption.IF_VERSION is not used and the operation succeeds provided that the server supports providing the existing row.
This parameter is optional and defaults to False. It’s use may incur additional cost.
- Parameters:
return_row (bool) – set to True if information should be returned.
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if return_row is not True or False.
- set_table_name(table_name)[source]¶
Sets the table name to use for the operation. This is a required parameter.
- Parameters:
table_name (str) – the table name.
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if table_name is not a string.
- set_timeout(timeout_ms)[source]¶
Sets the optional request timeout value, in milliseconds. This overrides any default value set in
NoSQLHandleConfig. The value must be positive.- Parameters:
timeout_ms (int) – the timeout value, in milliseconds.
- Returns:
self.
- Raises:
IllegalArgumentException – raises the exception if the timeout value is less than or equal to 0.