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

Cassandra is a free and open-source, distributed, wide-column store, NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or Docker Desktop.
  2. To connect Apache Cassandra to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to Apache Cassandra.

Implementation

As ScyllaDB is API-compatible with Apache Cassandra, the Cassandra data handler extends the ScyllaDB handler and uses the scylla-driver Python library.

The required arguments to establish a connection are as follows:

  • host is the host name or IP address of the Cassandra database.
  • port is the port to use when connecting.
  • user is the user to authenticate.
  • password is the password to authenticate the user.
  • keyspace is the keyspace to connect, the top level container for tables.
  • protocol_version is not required and defaults to 4.

Usage

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

CREATE DATABASE sc
WITH
  engine = "cassandra",
  parameters = {
    "host": "127.0.0.1",
    "port": "9043",
    "user": "user",
    "password": "pass",
    "keyspace": "test_data",
    "protocol_version": 4
  };

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

SELECT *
FROM cassandra_datasource.example_table LIMIT 10;