Table of Contents

Interface IDatabaseAdmin

Namespace
DataStax.AstraDB.DataApi.Admin
Assembly
DataStax.AstraDB.DataApi.dll

Defines administrative operations for a database, including keyspace management and discovery of embedding and reranking providers.

public interface IDatabaseAdmin

Methods

CreateKeyspace(string, CreateKeyspaceOptions)

void CreateKeyspace(string keyspace, CreateKeyspaceOptions options = null)

Parameters

keyspace string

The name of the keyspace to create.

options CreateKeyspaceOptions

Optional settings that influence request execution.

Examples

await admin.CreateKeyspaceAsync("myKeyspace");

Remarks

This method, by default, will wait for the operation to complete on the server side. Use the options' waitForCompletion attribute to control this behaviour.

CreateKeyspaceAsync(string, CreateKeyspaceOptions)

Creates a new keyspace with the specified name.

Task CreateKeyspaceAsync(string keyspace, CreateKeyspaceOptions options = null)

Parameters

keyspace string

The name of the keyspace to create.

options CreateKeyspaceOptions

Optional settings that influence request execution.

Returns

Task

Examples

await admin.CreateKeyspaceAsync("myKeyspace");

Remarks

This method, by default, will wait for the operation to complete on the server side. Use the options' waitForCompletion attribute to control this behaviour.

DoesKeyspaceExist(string, DoesKeyspaceExistOptions)

bool DoesKeyspaceExist(string keyspace, DoesKeyspaceExistOptions options = null)

Parameters

keyspace string

The name of the keyspace to check.

options DoesKeyspaceExistOptions

Optional settings that influence request execution.

Returns

bool

A task that resolves to true if the keyspace exists; otherwise, false.

Examples

bool exists = await admin.DoesKeyspaceExistAsync("myKeyspace");
bool exists = admin.DoesKeyspaceExist("myKeyspace");

DoesKeyspaceExistAsync(string, DoesKeyspaceExistOptions)

Checks whether a keyspace with the specified name exists.

Task<bool> DoesKeyspaceExistAsync(string keyspace, DoesKeyspaceExistOptions options = null)

Parameters

keyspace string

The name of the keyspace to check.

options DoesKeyspaceExistOptions

Optional settings that influence request execution.

Returns

Task<bool>

A task that resolves to true if the keyspace exists; otherwise, false.

Examples

bool exists = await admin.DoesKeyspaceExistAsync("myKeyspace");

DropKeyspace(string, DropKeyspaceOptions)

void DropKeyspace(string keyspace, DropKeyspaceOptions options = null)

Parameters

keyspace string

The name of the keyspace to drop.

options DropKeyspaceOptions

Optional settings that influence request execution.

Examples

await admin.DropKeyspaceAsync("myKeyspace", options);

DropKeyspaceAsync(string, DropKeyspaceOptions)

Drops the keyspace with the specified name.

Task DropKeyspaceAsync(string keyspace, DropKeyspaceOptions options = null)

Parameters

keyspace string

The name of the keyspace to drop.

options DropKeyspaceOptions

Optional settings that influence request execution.

Returns

Task

Examples

await admin.DropKeyspaceAsync("myKeyspace", options);

FindEmbeddingProviders(FindEmbeddingProvidersOptions)

FindEmbeddingProvidersResult FindEmbeddingProviders(FindEmbeddingProvidersOptions options = null)

Parameters

options FindEmbeddingProvidersOptions

Optional settings that influence request execution.

Returns

FindEmbeddingProvidersResult

A FindEmbeddingProvidersResult containing the discovered providers.

Examples

var providers = await admin.FindEmbeddingProvidersAsync();
var providers = admin.FindEmbeddingProviders();

FindEmbeddingProvidersAsync(FindEmbeddingProvidersOptions)

Finds and returns available embedding providers for the current database.

Task<FindEmbeddingProvidersResult> FindEmbeddingProvidersAsync(FindEmbeddingProvidersOptions options = null)

Parameters

options FindEmbeddingProvidersOptions

Optional settings that influence request execution.

Returns

Task<FindEmbeddingProvidersResult>

A FindEmbeddingProvidersResult containing the discovered providers.

Examples

var providers = await admin.FindEmbeddingProvidersAsync();

FindRerankingProviders(FindRerankingProvidersOptions)

FindRerankingProvidersResult FindRerankingProviders(FindRerankingProvidersOptions options = null)

Parameters

options FindRerankingProvidersOptions

Optional settings that influence request execution.

Returns

FindRerankingProvidersResult

A FindRerankingProvidersResult containing the discovered providers.

Examples

var providers = await admin.FindRerankingProvidersAsync();
var providers = admin.FindRerankingProviders();

FindRerankingProvidersAsync(FindRerankingProvidersOptions)

Finds and returns available reranking providers for the current database.

Task<FindRerankingProvidersResult> FindRerankingProvidersAsync(FindRerankingProvidersOptions options = null)

Parameters

options FindRerankingProvidersOptions

Optional settings that influence request execution.

Returns

Task<FindRerankingProvidersResult>

A FindRerankingProvidersResult containing the discovered providers.

Examples

var providers = await admin.FindRerankingProvidersAsync();

GetDatabase(GetDatabaseOptions)

Returns a Database instance for non-admin usage.

Database GetDatabase(GetDatabaseOptions options = null)

Parameters

options GetDatabaseOptions

options for the returned database: useful to override timeouts and other behavior.

Returns

Database

A Database instance representing the current database.

Examples

var database = admin.GetDatabase("myToken");

GetDatabase(string, GetDatabaseOptions)

Returns a Database instance for non-admin usage.

Database GetDatabase(string token, GetDatabaseOptions options = null)

Parameters

token string

The token that will be used by the database. Omit to keep using the current token.

options GetDatabaseOptions

options for the returned database: useful to override timeouts and other behavior.

Returns

Database

A Database instance representing the current database.

Examples

var database = admin.GetDatabase("myToken");

ListKeyspaces(ListKeyspacesOptions)

IEnumerable<string> ListKeyspaces(ListKeyspacesOptions options = null)

Parameters

options ListKeyspacesOptions

Optional settings that influence request execution.

Returns

IEnumerable<string>

A collection of keyspace names.

Examples

var keyspaces = await admin.ListKeyspacesAsync();
IEnumerable<string> keyspaces = admin.ListKeyspaces();

ListKeyspacesAsync(ListKeyspacesOptions)

Lists the names of all keyspaces in the database.

Task<IEnumerable<string>> ListKeyspacesAsync(ListKeyspacesOptions options = null)

Parameters

options ListKeyspacesOptions

Optional settings that influence request execution.

Returns

Task<IEnumerable<string>>

A collection of keyspace names.

Examples

var keyspaces = await admin.ListKeyspacesAsync();