Get a database admin (Go)

The Data API clients use the Database Admin class to perform administrative operations, like managing keyspaces, within a specific database.

The Database Admin class name varies by client. The Go client uses DataAPIDatabaseAdmin.

Result

Returns a DataAPIDatabaseAdmin struct that can perform administrative actions on the specified database.

Parameters

Use the DatabaseAdmin method, which belongs to the Db type.

Method signature
func (d *Db) DatabaseAdmin() (DataAPIDatabaseAdmin, error)

This method does not accept any parameters.

Examples

The following examples demonstrate how to get a database admin object.

Get a database admin from a database

package main

import (
	"log"

	"github.com/datastax/astra-db-go/v2/astra"
	"github.com/datastax/astra-db-go/v2/astra/options"
)

func main() {
	// Get a database
	client := astra.NewClient(
		options.API().SetEnvironment(options.EnvironmentHCD),
	)

	database := client.Database(
		"API_ENDPOINT",
		options.API().
			SetUsernamePasswordTokenProvider(
				"USERNAME",
				"PASSWORD",
			).
			SetKeyspace("KEYSPACE_NAME"),
	)

	// Get a database admin
	_, err := database.DatabaseAdmin()

	if err != nil {
		log.Fatal(err)
	}
}

Client reference

For more information, see the client reference.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM