Find a database
Gets information about a 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 an AstraDBAdminDatabaseInfo object that contains information about the requested database, including the database ID, name, keyspaces, and status.
Returns a promise that resolves to a FullDatabaseInfo object that contains information about the requested database, including the database ID, name, keyspaces, and status.
Returns a DatabaseInfo object that contains information about the requested database, including the database ID, name, keyspaces, and status.
Returns 200 Success and an object that contains information about the requested database, including the database ID, name, keyspaces, and status.
Example response, 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
Use the database_info method, which belongs to the AstraDBAdmin class.
Method signature
database_info(
id: str,
*,
database_admin_timeout_ms: int,
request_timeout_ms: int,
timeout_ms: int,
) -> AstraDBAdminDatabaseInfo
| Name | Type | Summary |
|---|---|---|
|
|
The ID of the target database. |
|
|
Optional.
A timeout, in milliseconds, to impose on the underlying API request.
If not provided, the This parameter is aliased as |
Use the dbInfo method, which belongs to the AstraAdmin class.
Method signature
async dbInfo(
id: string,
options?: {
timeout: number | TimeoutDescriptor,
}
): AstraFullDatabaseInfo;
| Name | Type | Summary |
|---|---|---|
|
|
The ID of the target database. |
|
|
Optional. A timeout to impose on the underlying API request. |
Use the getDatabaseInfo method, which belongs to the com.datastax.astra.client.admin.AstraDBAdmin class.
Method signature
DatabaseInfo getDatabaseInfo(UUID id)
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.
Command signature
curl -sS -L -X GET "https://api.astra.datastax.com/v2/databases/DATABASE_ID" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"
Examples
The following examples demonstrate how to find a database.
-
Python
-
TypeScript
-
Java
-
curl
from astrapy import DataAPIClient
client = DataAPIClient("APPLICATION_TOKEN")
admin = client.get_admin()
database_info = admin.database_info("DATABASE_ID")
print(database_info)
import { DataAPIClient } from "@datastax/astra-db-ts";
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();
(async function () {
const databaseInfo = await admin.dbInfo("DATABASE_ID");
console.log(databaseInfo);
})();
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.admin.AstraDBAdmin;
import com.datastax.astra.client.databases.definition.DatabaseInfo;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
DataAPIClient client = new DataAPIClient("APPLICATION_TOKEN");
AstraDBAdmin admin = client.getAdmin();
DatabaseInfo databaseInfo = admin.getDatabaseInfo(UUID.fromString("DATABASE_ID"));
System.out.println(databaseInfo);
}
}
curl -sS -L -X GET "https://api.astra.datastax.com/v2/databases/DATABASE_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.