> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindsdb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DataStax

This is the implementation of the DataStax data handler for MindsDB.

[https://docs.datastax.com/en/astra-db-serverless/index.html\[DataStax](https://docs.datastax.com/en/astra-db-serverless/index.html\[DataStax) Astra DB] is a cloud database-as-a-service based on Apache Cassandra. DataStax also offers on-premises solutions, DataStax Enterprise (DSE) and Hyper-Converged Database (HCD), as well as Astra Streaming, a messaging and event streaming cloud service based on Apache Pulsar.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB locally via [Docker](/setup/self-hosted/docker) or [Docker Desktop](/setup/self-hosted/docker-desktop).
2. To connect DataStax to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Create an [Astra DB database](https://docs.datastax.com/en/astra-db-serverless/databases/create-database.html).

## Implementation

DataStax Astra DB is API-compatible with Apache Cassandra and ScyllaDB. Therefore, its implementation extends the ScyllaDB handler and is using the `scylla-driver` Python library.

The required arguments to establish a connection are as follows:

* `user`: The literal string `token`
* `password`: An [Astra application token](https://docs.datastax.com/en/astra-db-serverless/administration/manage-application-tokens.html)
* `secure_connect_bundle`: The path to your database's [Secure Connect Bundle](https://docs.datastax.com/en/astra-db-serverless/databases/secure-connect-bundle.html) zip file

## Usage

In order to make use of this handler and connect to the Astra DB database in MindsDB, the following syntax can be used:

```sql theme={null}
CREATE DATABASE astra_connection
WITH
    engine = "astra",
    parameters = {
        "user": "token",
        "password": "application_token",
        "secure_connect_bundle": "/home/Downloads/file.zip"
    };
```

or, reference the bundle from Datastax s3 as:

```sql theme={null}
CREATE DATABASE astra_connection
WITH ENGINE = "astra",
PARAMETERS = {
    "user": "token",
    "password": "application_token",
    "secure_connect_bundle": "https://datastax-cluster-config-prod.s3.us-east-2.amazonaws.com/32312-b9eb-4e09-a641-213eaesa12-1/secure-connect-demo.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AK..."
}  
```

You can use this established connection to query your table as follows:

```sql theme={null}
SELECT *
FROM astra_connection.keystore.example_table
LIMIT 10;
```
