Get an Astra DB admin (Python)
The Data API clients use the Astra DB Admin class to perform administrative operations like creating and dropping databases.
To perform administrative actions within a specific database, see Get a database admin (Python) instead.
The Astra DB Admin class name varies by client.
The Python client uses AstraDBAdmin.
|
You need an application token with permission to create and configure databases, such as the Organization Administrator role. For more information, see Get endpoint and token. |
Result
Returns an AstraDBAdmin object that can perform administrative actions.
Signature
Use the get_admin method from the DataAPIClient class.
get_admin(
*,
token: str | TokenProvider,
spawn_api_options: APIOptions,
) -> AstraDBAdmin
Parameters
| Name | Type | Summary |
|---|---|---|
|
|
Optional. The token used by the resulting admin object. The token should have sufficient permissions to perform the desired downstream operations. Default: The token used by the object that called this method. |
|
Optional.
A complete or partial specification of the If |
Examples
The following examples demonstrate how to get an Astra DB admin.
from astrapy import DataAPIClient
# Get an admin object
client = DataAPIClient("APPLICATION_TOKEN")
admin = client.get_admin()
Errors
For a full list of Data API error codes and their corresponding messages, see Data API errors and error codes.
For more information about how the client handles underlying Data API errors, see Python client error handling.
Client reference
For more information, see the client reference.