Find a database
Get information about one database.
|
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
-
Python
-
TypeScript
-
Java
-
curl
Returns:
AstraDBAdminDatabaseInfo - An object containing the requested information.
Result
For clarity, this example is reformatted in pprint-style.
AstraDBAdminDatabaseInfo(
id=01234567-89ab-cdef-0123-456789abcdef,
name=my_database,
keyspaces=['default_keyspace', 'alternate_keyspace'],
status=ACTIVE,
environment=prod,
cloud_provider=AWS,
created_at=2024-12-17 21:52:43+00:00,
last_used=2025-04-02 14:31:04+00:00,
org_id=aabbccdd-eeff-0011-2233-445566778899,
owner_id=00112233-4455-6677-8899aabbddeeff,
regions=[
AstraDBAdminDatabaseRegionInfo(
name=us-east-2,
id=01234567-89ab-cdef-0123-456789abcdef-1,
api_endpoint=https://01234567-89ab-cdef-0123-456789abcdef-us-east-2.apps.astra.datastax.com,
created_at=2024-12-17 21:52:43+00:00
)
],
raw=...
)
Returns:
Promise<FullDatabaseInfo> - A promise that resolves to the
complete information for the corresponding database.
Returns:
DatabaseInfo - An object containing database metadata.
The UUID ensures that the database is unique.
Returns either one matching database or no databases.
Returns:
A successful request returns 200 Success and an object containing database information.
Result
This example response is truncated for brevity.
{
"id": "DB_ID",
"orgId": "organizations/ORG_ID",
"ownerId": "users/USER_ID",
"info": {
"name": "DB_NAME",
"keyspace": "INITIAL_KEYSPACE_NAME",
"cloudProvider": "CLOUD_PROVIDER",
"region": "REGION",
"additionalKeyspaces": [
"SECOND_KEYSPACE_NAME"
],
"dbType": "vector"
},
"creationTime": "2012-11-01T22:08:41+00:00",
"terminationTime": "2019-11-01T22:08:41+00:00",
"status": "ACTIVE",
# Response truncated for brevity
}
Parameters
-
Python
-
TypeScript
-
Java
-
curl
This operation is done through an instance of the AstraDBAdmin class.
db_info = admin.database_info("DB_ID")
Parameters:
| Name | Type | Summary |
|---|---|---|
|
|
The ID of the target database. |
|
|
A timeout, in milliseconds, for the API request. This parameter is aliased as |
This operation is done through an instance of the AstraAdmin class.
const dbInfo = admin.dbInfo('DB_ID');
Parameters:
| Name | Type | Summary |
|---|---|---|
|
|
The ID of the target database. |
|
The options (the timeout) for this operation. |
// Given 'admin', a AstraDBAdmin object
admin.getDatabaseInfo(UUID databaseId);
Parameters:
| Name | Type | Summary |
|---|---|---|
|
|
The ID of the target database. |
Use the DevOps API to get information about a database programmatically.
The application token must have sufficient permissions to perform the requested operations, such as the Database Administrator role.
Examples
The following examples demonstrate how to find a database.
-
Python
-
TypeScript
-
Java
-
curl
from astrapy import DataAPIClient
client = DataAPIClient("TOKEN")
admin = client.get_admin()
db_details = admin.database_info("01234567-...")
db_details.id
# '01234567-...'
db_details.status
# 'ACTIVE'
db_details.regions[0].name
# 'eu-west-1'
import { DataAPIClient } from '@datastax/astra-db-ts'
const admin = new DataAPIClient('TOKEN').admin();
(async function () {
const details = await admin.dbInfo('DB_ID');
console.log(details.id); // '01234567-...'
console.log(details.status); // 'ACTIVE'
console.log(details.info.region); // 'eu-west-1'
})();
package com.datastax.astra.client.admin;
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.databases.definition.DatabaseInfo;
import java.util.UUID;
public class GetDatabaseInformation {
public static void main(String[] args) {
AstraDBAdmin astraDBAdmin = new DataAPIClient("TOKEN").getAdmin();
// Check if a database exists
boolean exists1 = astraDBAdmin.databaseExists("database_name");
boolean exists2 = astraDBAdmin.databaseExists(UUID.fromString("<database_id>"));
// Find a database by name (names may not be unique)
DatabaseInfo databaseInformation = astraDBAdmin
.getDatabaseInfo(UUID.fromString("<database_id>"));
System.out.println("Name=" + databaseInformation.getName());
}
}
curl -sS -L -X GET "https://api.astra.datastax.com/v2/databases/DB_ID" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"
Client reference
-
Python
-
TypeScript
-
Java
-
curl
For more information, see the client reference.
For more information, see the client reference.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.