Adding other Database in n8n !?

I need some help to fix this problem:

I like to add the Apache Cassandra Database to n8n but there is no possibility. so, I need help here to fix this problem how do I add Cassandra in n8n ?.

1 Like

hello @Ashiqur_rahman

Can you share a bit more detail here, what are you trying to accomplish exactly? If you have a workflow, can you please share it?

Thanks!

:rocket: Connecting Cassandra to n8n via Stargate

If you wanna talk to Apache Cassandra from n8n, unlike PostgreSQL or MySQL, there’s no built-in database adapter for Cassandra in n8n. But don’t worry—Stargate acts as a bridge, allowing you to interact with Cassandra using HTTP requests! :bridge_at_night:

:hammer_and_wrench: Step 1: Set Up Cassandra & Stargate

First, you need to install Cassandra and Stargate and make sure they’re running on the same Docker network as your n8n instance. If you’re using the self-hosted-ai-starter-kit from GitHub, check that your network is properly set up:

docker network inspect self-hosted-ai-starter-kit_demo

Now, launch Cassandra first, then Stargate (order matters!):

docker run --name cass1 \
  --network self-hosted-ai-starter-kit_demo \
  -e CASSANDRA_CLUSTER_NAME=stargate-cluster \
  -d cassandra:4.0
docker run --name stargate \
  --network self-hosted-ai-starter-kit_demo \
  -p 8080:8080 -p 8081:8081 -p 8082:8082 -p 9049:9042 \
  -e CLUSTER_NAME=stargate-cluster \
  -e CLUSTER_VERSION=4.0 \
  -e SEED=cass1 \
  -e SIMPLE_SNITCH=true \
  -e ENABLE_AUTH=true \
  -d stargateio/stargate-4_0:v1.0.57

:mag: Step 2: Sanity Check (Optional but Smart :bulb:)

Once the containers are up and running, it’s a good idea to run a sanity check using the Cassandra Query Shell (CQLSH).

Or, an even easier way—test Stargate’s API using Postman! The Stargate Postman Collection lets you fire requests and confirm everything is working. If you get a 201 OK response, you’re golden! :trophy:


:key: Step 3: Get an Auth Token

Before making database queries, you need an Auth Token. This token is used in all future requests under the X-Cassandra-Token header.

Run this cURL command to authenticate with Stargate:

curl -L -X POST 'http://localhost:8081/v1/auth' \
  -H 'Content-Type: application/json' \
  --data-raw '{"username": "cassandra","password": "cassandra"}'

If successful, you’ll get a response like this:

{"authToken": "0e073bf6-ada6-4fdd-ab5b-98f9bad04ca7"}

:arrows_counterclockwise: Step 4: Configure n8n’s HTTP Request Node

Now that you have your Auth Token, let’s hook it up to n8n:

  1. In n8n, add an HTTP Request node.

  2. Set the Method to POST.

  3. Use this URL:

    http://stargate:8081/v1/auth
    
  4. Under Body, choose JSON format and add:

    {
        "username": "{{auth_username}}",
        "password": "{{auth_password}}"
    }
    
  5. Store the Auth Token from the response and use it in future requests by adding a header:

    X-Cassandra-Token: {{AUTH_TOKEN}}
    

:tada: Boom! You’re connected to Cassandra via Stargate in n8n! Now you can start making queries, inserting data, and pulling insights like a database wizard. :man_mage::sparkles:

Need more details? Check out:
:books: Stargate Docs
:toolbox: Stargate Postman Collection


The initial HTTP request node will get the AUTH_TOKEN to be used in subsequent HTTP calls using the header: X-Cassandra-Token

This is how to setup db connector stargate.
Stargate is a very helpful db connector/adapter if you are not using postgres or mysql databases for example eg. Cassadra DB is not directly supported by n8n .

Please don’t delete this info - its a post I made myself as a reply that got blocked :frowning: