Tip
If you already have a Cassandra instance running, skip the steps to run Cassandra in a Docker container.
-
Start a Cassandra instance:
docker run -d --rm --name cassandra -p 9042:9042 cassandra:latest
-
Wait for Cassandra to accept connections. This can take a minute or two:
docker exec cassandra cqlsh -e "DESCRIBE CLUSTER"
If the command fails, wait a few seconds and run it again.
-
Install the Cassandra ADBC driver:
dbc install --pre cassandra
-
Customize the Python script
main.pyas needed- Change the connection arguments in
db_kwargs- Format
uriaccording to the driver documentation, or keep it as is
- Format
- Change the connection arguments in
-
Run the Python script:
uv run main.py
Stop the Docker container running Cassandra:
docker stop cassandra