cassandra/pylib
Ekaterina Dimitrova b47179b7d4
Add option to disable cqlsh history
We can disable saving of the history either via command-line parameter --disable-history, or by setting disabled = True in the history section of the cqlshrc. Both options will read existing history, and just won't save new commands.

Update help and docs for cqlsh history.
Add startup info logline whenr history logging is enabled.
Add a fix for cqlshrc file path not correctly expanding.

Includes the Backport of
  Allows users to change cqlsh history location using env variable
  patch by Stefan Miklosovic; reviewed by Brandon Williams for CASSANDRA-17448

patch by Ekaterina Dimitrova; reviewed by Mick Semb Wever for CASSANDRA-XXX

Co-authored-by: Alex Ott alex.ott@datastax.com
Co-authored-by: Jaroslaw Grabowski jaroslaw.grabowski@datastax.com
2026-03-17 23:01:57 +01:00
..
cqlshlib Add option to disable cqlsh history 2026-03-17 23:01:57 +01:00
README.asc Fix instructions in README.asc of pylib 2026-03-11 14:10:57 +01:00
cassandra-cqlsh-tests.sh Merge branch 'cassandra-3.0' into cassandra-3.11 2025-12-19 23:34:02 +01:00
pytest.ini Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
requirements.txt Merge branch 'cassandra-3.11' into cassandra-4.0 2025-12-19 23:34:52 +01:00
setup.py Make cython optional in pylib/setup.py 2016-04-27 08:42:32 +08:00

README.asc

== Overview

This directory contains code primarily for cqlsh. cqlsh uses cqlshlib in this directory.
Currently, cqlshlib supports Python 2 as well as Python 3. Support for Python 3 is relatively
new.

== Requirements
. Python 3 and 2.7 (for cqlsh)
. virtualenv
. Docker (optional)

== Running tests

In order to run tests for cqlshlib, run cassandra-cqlsh-tests.sh in this directory. It will
automatically setup a virtualenv with the appropriate version of Python and run tests inside it.

To run cqlsh using publicly available Docker images to connect to Cassandra on the same host, with `$CASSANDRA_DIR` pointing to either the source or install directory where `bin/cqlsh` is located.

For Python 3.11:

  $ docker run -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh host.docker.internal

For Python 2.7:

  $ docker run -v $CASSANDRA_DIR:/code -it python:2.7-slim /code/bin/cqlsh host.docker.internal

If `host.docker.internal` isn't supported, then you can use `--net="host"`:

  $ docker run --net="host" -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh

This will try to spawn a cqlsh instance inside the Docker container with a minimal Python installation. It will try to connect to the Cassandra instance running on the Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal with the IP / hostname as usual. Please ensure that the IP / host is accessible from _within_ the Docker container.