Get a database admin (Python)
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 Python client uses DatabaseAdmin.
Result
Returns an DatabaseAdmin object that can perform administrative actions on the specified database.
Parameters
Use the get_database_admin method from the Database class.
Method signature
get_database_admin(
*,
token: str | TokenProvider,
spawn_api_options: APIOptions,
) -> DatabaseAdmin
| 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 ttimeouts. If |
Examples
The following examples demonstrate how to get a database admin object.
Get a database admin from a database
from astrapy import DataAPIClient
from astrapy.authentication import UsernamePasswordTokenProvider
from astrapy.constants import Environment
# Get a database object
client = DataAPIClient(environment=Environment.HCD)
database = client.get_database(
"API_ENDPOINT",
token=UsernamePasswordTokenProvider("USERNAME", "PASSWORD"),
)
# Get a database admin object
database_admin = database.get_database_admin()
Client reference
For more information, see the client reference.