Cassandra command line shell written in Golang
Having a cassandra command line shell utility in one binary distributable.
- Building docker images for cassandra from Alpine with no Python.
- Running cql shell on all platforms.
- Automating cassandra schema creation without need to install python dependencies.
brew tap npenkov/gcqlsh
brew install gcqlshOr install directly from the repository:
brew install npenkov/gcqlsh/gcqlshnix run github:npenkov/gcqlshnix profile install github:npenkov/gcqlsh{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
gcqlsh.url = "github:npenkov/gcqlsh";
};
outputs = { self, nixpkgs, gcqlsh }: {
# ... your configuration
environment.systemPackages = [
gcqlsh.packages.${system}.default
];
};
}nix develop github:npenkov/gcqlshgo install github.com/npenkov/gcqlsh/cmd/gcqlsh@latestDownload the latest release binary for your platform from the releases page.
go build -o gocqlsh src/github.com/npenkov/gcqlsh/cmd/gcqlsh.go
- Running DDL script files from command line
- Support for Cassandra 2.1+/ScyllaDB
- CQL Support
- Statement tracing
desccommand withkeyspaces- simple listtables- simple listtable- simple list of columns and types
- Auto completition for commands:
use- keyspacesdesc- tablesselect- tablesupdate- tables and columnsdelete- tablesinsert- tables
- Paging in interactive results
- DDL Statements when describing Keyspaces and tables
- Expanded rows
- Code assistance for different keyspaces
- Node token awareness
gcqlsh -h
Usage of gcqlsh:
-f string
Execute file containing cql statements instead of having interacive session
-fail-on-error
Stop execution if statement from file fails.
-host string
Cassandra host to connect to (default "127.0.0.1")
-k string
Default keyspace to connect to (default "system")
-no-color
Console without colors
-password string
Password used for the connection
-port int
Cassandra RPC port (default 9042)
-print-confirmation
Print 'ok' on successfuly executed cql statement from the file
-print-cql
Print Statements that are executed from a file
-username string
Username used for the connection
-v Version information
descfor table- Column code assistance for
selectupdatedeleteinsert
This project uses GoReleaser for automated releases.
-
Update the
VERSIONfile with the new version number:echo "0.0.4" > VERSION
-
Commit the version change:
git add VERSION git commit -m "Bump version to 0.0.4" -
Create and push a tag:
git tag -a v0.0.4 -m "Release v0.0.4" git push origin v0.0.4 -
GitHub Actions will automatically:
- Run tests
- Build binaries for multiple platforms (Linux, macOS, Windows)
- Create checksums
- Generate release notes
- Publish the release on GitHub
To test the release process locally without publishing:
# Install goreleaser
go install github.com/goreleaser/goreleaser/v2@latest
# Test the release (snapshot mode)
goreleaser release --snapshot --clean
# Check the dist/ directory for generated artifacts
ls -la dist/The project includes comprehensive unit tests that run against a real Cassandra instance using Docker.
Quick Start (Recommended for all platforms, especially macOS):
make testAlternative test commands:
make test-local # Run tests locally (may fail on macOS)
make test-docker-compose # Run tests using docker-compose (best for macOS)
make test-coverage # Run tests with coverage reportmacOS Users: If you encounter connection errors like:
gocql: unable to dial control conn 127.0.0.1:55006: connect: connection refused
Use make test (which runs docker-compose mode) instead of make test-local.
Why? Docker Desktop for Mac uses a VM, and direct port mapping from dockertest doesn't always work. The docker-compose approach uses Docker's internal networking for reliable connectivity.
For more details, see internal/action/README_TESTS.md.
make build # Build all platforms
make linux # Build for Linux
make darwin # Build for macOS
make windows # Build for WindowsWritten with vim-go
Copyright (c) 2016-2025 Nick Penkov. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
