PrepareRequest

class borneo.PrepareRequest[source]

Bases: borneo.operations.Request

A request that encapsulates a query prepare call. Query preparation allows queries to be compiled (prepared) and reused, saving time and resources. Use of prepared queries vs direct execution of query strings is highly recommended.

Prepared queries are implemented as PreparedStatement which supports bind variables in queries which can be used to more easily reuse a query by parameterization.

The statement is required parameter.

Methods Summary

get_compartment() Cloud service only.
get_query_plan() Returns whether a JSON representation of the query execution plan should be included in the PreparedStatement.
get_statement() Returns the query statement.
get_timeout() Returns the timeout to use for the operation, in milliseconds.
set_compartment(compartment) Cloud service only.
set_get_query_plan(get_query_plan) Sets whether a JSON representation of the query execution plan should be included in the PreparedStatement.
set_statement(statement) Sets the query statement.
set_timeout(timeout_ms) Sets the request timeout value, in milliseconds.

Methods Documentation

get_compartment()

Cloud service only.

Get the compartment id or name if set for the request.

Returns:compartment id or name if set for the request, otherwise None if not set.
Return type:str
get_query_plan()[source]

Returns whether a JSON representation of the query execution plan should be included in the PreparedStatement.

Returns:whether the the query execution plan should be included in the PreparedStatement.
Return type:bool
get_statement()[source]

Returns the query statement.

Returns:the statement, or None if it has not been set.
Return type: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 value.
Return type:int
set_compartment(compartment)[source]

Cloud service only.

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().

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_get_query_plan(get_query_plan)[source]

Sets whether a JSON representation of the query execution plan should be included in the PreparedStatement.

Parameters:get_query_plan (bool) – True if a the query execution plan should be included in the PreparedStatement. False otherwise.
Returns:self.
Raises:IllegalArgumentException – raises the exception if get_query_plan is not a boolean.
set_statement(statement)[source]

Sets the query statement.

Parameters:statement (str) – the query statement.
Returns:self.
Raises:IllegalArgumentException – raises the exception if statement is not a string.
set_timeout(timeout_ms)[source]

Sets the 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.