Interface CreateTableOptions<Def>

Options for creating a new table (via Db.createTable).

See Db.createTable & Table for more information.

Field

definition - The bespoke columns/primary-key definition for the table.

Field

ifNotExists - Makes operation a no-op if the table already exists.

Field

keyspace - Overrides the keyspace for the table (from the Db's working keyspace).

Field

embeddingApiKey - The embedding service's API-key/headers (for $vectorize)

Field

timeoutDefaults - Default timeouts for all table operations

Field

logging - Logging configuration overrides

Field

serdes - Additional serialization/deserialization configuration

Field

timeout - The timeout override for this method

interface CreateTableOptions<Def> {
    definition: Def;
    embeddingApiKey?: null | string | EmbeddingHeadersProvider;
    ifNotExists?: boolean;
    keyspace?: string;
    logging?: DataAPILoggingConfig;
    serdes?: TableSerDesConfig;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "tableAdminTimeoutMs" | "requestTimeoutMs">;
    timeoutDefaults?: Partial<TimeoutDescriptor>;
}

Type Parameters

Hierarchy (view full)

Properties

definition: Def
embeddingApiKey?: null | string | EmbeddingHeadersProvider

The API key for the embedding service to use, or the EmbeddingHeadersProvider if using a provider that requires it (e.g. AWS bedrock).

ifNotExists?: boolean
keyspace?: string

The keyspace to use for the operation.

The configuration for logging events emitted by the DataAPIClient.

This can be set at any level of the major class hierarchy, and will be inherited by all child classes.

See DataAPILoggingConfig for much more information on configuration, outputs, and inheritance.

Advanced & currently somewhat unstable features related to customizing the table's ser/des behavior at a lower level.

Use with caution. See official DataStax documentation for more info.

timeout?: number | Pick<Partial<TimeoutDescriptor>, "tableAdminTimeoutMs" | "requestTimeoutMs">

The method timeout override.

See TimeoutDescriptor for much more information.

timeoutDefaults?: Partial<TimeoutDescriptor>
Overview

The default timeout options for any operation performed on this Table instance.

See TimeoutDescriptor for much more information about timeouts.

Example

// The request timeout for all operations is set to 1000ms.
const client = new DataAPIClient('...', {
  timeoutDefaults: { requestTimeoutMs: 1000 },
});

// The request timeout for all operations borne from this Db is set to 2000ms.
const db = client.db('...', {
  timeoutDefaults: { requestTimeoutMs: 2000 },
});
Inheritance

The timeout options are inherited by all child classes, and can be overridden at any level, including the individual method level.

Individual-method-level overrides can vary in behavior depending on the method; again, see TimeoutDescriptor.

Defaults

The default timeout options are as follows:

  • requestTimeoutMs: 10000
  • generalMethodTimeoutMs: 30000
  • collectionAdminTimeoutMs: 60000
  • tableAdminTimeoutMs: 30000
  • databaseAdminTimeoutMs: 600000
  • keyspaceAdminTimeoutMs: 30000

See

TimeoutDescriptor