Package oracle.nosql.driver.ops

# Class TableRequest

java.lang.Object
oracle.nosql.driver.ops.Request
oracle.nosql.driver.ops.TableRequest

public class TableRequest extends Request
TableRequest is used to create, modify, and drop tables. The operations allowed are those supported by the Data Definition Language (DDL) portion of the query language. The language provides for table creation and removal (drop), index add and drop, as well as schema evolution via alter table. Operations using DDL statements infer the table name from the query statement itself, e.g. "create table mytable(...)". Table creation requires a valid `TableLimits` object to define the throughput desired for the table. If TableLimits is provided with any other type of query statement an exception is thrown.

This request is also used to modify the limits of throughput and storage for an existing table. This case is handled by specifying a table name and limits without a query statement. If all three are specified it is an error.

This request is also used to modify tags associated with an existing table. This use is mutually exclusive with respect to changing a table schema or its limits. To modify tags specify only tags and the table name without a statement.

Execution of operations specified by this request is implicitly asynchronous. These are potentially long-running operations. `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)` returns a `TableResult` instance that can be used to poll until the table reaches the desired state.

See Also:
  - `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TableRequest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DefinedTags`
  `getDefinedTags()`
  Cloud service only.
  `FreeFormTags`
  `getFreeFormTags()`
  Cloud service only.
  `String`
  `getMatchETag()`
  Cloud service only.
  `String`
  `getStatement()`
  Returns the statement, or null if not set
  `TableLimits`
  `getTableLimits()`
  Returns the table limits, or null if not set
  `String`
  `getTypeName()`
  Returns the type name of the request.
  `TableRequest`
  `setCompartment(String compartment)`
  Cloud service only.
  `TableRequest`
  `setDefaults(NoSQLHandleConfig config)`
  `TableRequest`
  `setDefinedTags(DefinedTags definedTags)`
  Cloud service only.
  `TableRequest`
  `setFreeFormTags(FreeFormTags freeFormTags)`
  Cloud service only.
  `TableRequest`
  `setMatchEtag(String etag)`
  Cloud service only.
  `TableRequest`
  `setNamespace(String namespace)`
  Sets the optional namespace.
  `TableRequest`
  `setStatement(String statement)`
  Sets the query statement to use for the operation.
  `TableRequest`
  `setTableLimits(TableLimits tableLimits)`
  Cloud service only.
  `TableRequest`
  `setTableName(String tableName)`
  Sets the table name to use for the operation.
  `TableRequest`
  `setTimeout(int timeoutMs)`
  Sets the request timeout value, in milliseconds.
  `String`
  `toString()`
  `void`
  `validate()`

  ### Methods inherited from class oracle.nosql.driver.ops.Request

  `getCompartment, getNamespace, getRateLimitDelayedMs, getReadRateLimiter, getRetryStats, getTableName, getWriteRateLimiter, setReadRateLimiter, setWriteRateLimiter`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### TableRequest

    public TableRequest()

- ## Method Details

  - ### setCompartment

    public TableRequest setCompartment(String compartment)
    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 `SignatureProvider.createWithInstancePrincipal()`

    Parameters:
      `compartment` - the 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:
      this

  - ### getStatement

    public String getStatement()
    Returns the statement, or null if not set
    Returns:
      the statement

  - ### getTableLimits

    public TableLimits getTableLimits()
    Returns the table limits, or null if not set
    Returns:
      the limits

  - ### getDefinedTags

    public DefinedTags getDefinedTags()
    Cloud service only. Returns the `DefinedTags`, or null if not set
    Returns:
      the tags
    Since:
      5.4

  - ### getFreeFormTags

    public FreeFormTags getFreeFormTags()
    Cloud service only. Returns the `FreeFormTags`, or null if not set
    Returns:
      the tags
    Since:
      5.4

  - ### getMatchETag

    public String getMatchETag()
    Cloud service only. Returns the matchEtag, or null if not set
    Returns:
      the ETag
    Since:
      5.4

  - ### setStatement

    public TableRequest setStatement(String statement)
    Sets the query statement to use for the operation. This parameter is required unless the operation is intended to change the limits of an existing table.
    Parameters:
      `statement` - the statement
    Returns:
      this

  - ### setTableName

    public TableRequest setTableName(String tableName)
    Sets the table name to use for the operation. The table name is only used to modify the limits of an existing table, and must not be set for any other operation.
    Parameters:
      `tableName` - the name
    Returns:
      this

  - ### setTableLimits

    public TableRequest setTableLimits(TableLimits tableLimits)
    Cloud service only.

    Sets the table limits to use for the operation. Limits are used in only 2 cases -- table creation statements and limits modification operations. It is not used for other DDL operations.

    If limits are set for an on-premises service they are silently ignored.

    Parameters:
      `tableLimits` - the limits
    Returns:
      this

  - ### setDefinedTags

    public TableRequest setDefinedTags(DefinedTags definedTags)
    Cloud service only.

    Sets the `DefinedTags` to use for the operation. DefinedTags are used in only 2 cases -- table creation statements and tag modification operations. It is not used for other DDL operations.

    If tags are set for an on-premises service they are silently ignored.

    Parameters:
      `definedTags` - the tags
    Returns:
      this
    Since:
      5.4

  - ### setFreeFormTags

    public TableRequest setFreeFormTags(FreeFormTags freeFormTags)
    Cloud service only.

    Sets the `FreeFormTags` to use for the operation. FreeFormTags are used in only 2 cases -- table creation statements and tag modification operations. It is not used for other DDL operations.

    If tags are set for an on-premises service they are silently ignored.

    Parameters:
      `freeFormTags` - the tags
    Returns:
      this
    Since:
      5.4

  - ### setMatchEtag

    public TableRequest setMatchEtag(String etag)
    Cloud service only.

    Sets an ETag in the request that must be matched for the operation to proceed. The ETag must be non-null and have been returned in a previous `TableResult`. This is a form of optimistic concurrency control allowing an application to ensure no unexpected modifications have been made to the table.

    If set for an on-premises service the ETag is silently ignored.

    Parameters:
      `etag` - the ETag
    Returns:
      this
    Since:
      5.4

  - ### setTimeout

    public TableRequest setTimeout(int timeoutMs)
    Sets the request timeout value, in milliseconds. This overrides any default value set with `NoSQLHandleConfig.setTableRequestTimeout(int)`. The value must be positive.
    Parameters:
      `timeoutMs` - the timeout value, in milliseconds
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the timeout value is less than or equal to 0

  - ### setNamespace

    public TableRequest setNamespace(String namespace)
    Sets the optional namespace. On-premises only. This overrides any default value set with `NoSQLHandleConfig.setDefaultNamespace(java.lang.String)`. Note: if a namespace is specified in the table name for the request (using the namespace:tablename format), that value will override this setting.
    Parameters:
      `namespace` - the namespace to use for the operation
    Returns:
      this
    Since:
      5.4.10

  - ### setDefaults

    public TableRequest setDefaults(NoSQLHandleConfig config)

  - ### validate

    public void validate()

  - ### getTypeName

    public String getTypeName()
    Description copied from class: `Request`
    Returns the type name of the request. This is used for stats.
    Specified by:
      `getTypeName` in class `Request`
    Returns:
      the type name of the request

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`