Accessing data using CQL 

Resources for running CQL commands, including steps to launch the cqlsh utility.

Common ways to access CQL are:

  • CQL shell (cqlsh): a Python-based command-line client installed on DataStax Enterprise nodes.
  • DataStax drivers for developing applications.
  • DataStax Studio an interactive tool for exploring and visualizing large datasets using DSE Graph. It provides an intuitive interface for developers and analysts to collaborate and test theories by mixing code, documentation, query results and visualizations into self-documenting notebooks.

Starting cqlsh 

Launch the cqlsh utility with the default settings.

Execute the cqlsh python script to start the CQL shell; CQL shell is a python-based command line client for executing CQL commands interactively. CQL shell supports tab completion.

Tip: For a complete list of cqlsh options, see cqlsh (startup options).


  1. Navigate to the DataStax Enterprise installation directory.
  2. Start cqlsh on the Mac OSX, for example.
    If you use security features, provide a user name and password.
  3. Print the help menu for cqlsh.
    bin/cqlsh --help
  4. Optionally, specify the IP address and port to start cqlsh on a different node.
    bin/cqlsh 9042
    Note: You can use tab completion to see hints about how to complete a cqlsh command. Some platforms, such as Mac OSX, do not ship with tab completion installed. You can use easy_install to install tab completion capabilities on Mac OSX:
    easy_install readline

Using cqlsh on a Kerberos enabled cluster 

Installing the Kerberos python package and launch cqlsh with Kerberos settings using a configuration file.

How to install required packages to use cqlsh with Kerberos.


To use cqlsh with a Kerberos-enabled cluster, you must install:
  • python-pure-sasl is a pure Python client-side SASL (Simple Authentication and Security Layer) implementation.
  • PyKerberos is a high-level wrapper for Kerberos (GSSAPI) operations.

Kerberos User Principal, such as user@REALM.


To use cqlsh with Kerberos:

  1. Set up Kerberos on the DSE cluster using the guidelines, see Kerberos Guidelines.
  2. Ensure that the Kerberos client is installed and configured with your Kerberos realm (krb5.conf):
    • RHEL-based platforms
      yum install krb5-workstation krb5-libs krb5-auth-dialog
    • Debian-based platforms
      sudo apt-get install krb5-user
    • Mac OS X, see the documentation MIT Kerberos Consortium.
  3. Install pure-sasl:
    sudo pip install pure-sasl
  4. Install PyKerberos. Use only the python26-kerberos or python27-kerberos RPM provided by the repository for RedHat.
    • RHEL 6
      sudo yum install python26-kerberos
    • RHEL 7
      sudo yum install python27-kerberos
      Note: RedHat EL7 might install a python-kerberos RPM that is distributed on its own official repository, but it is not compatible with cqlsh kerberos. You must use the python27-kerberos RPM from the repository.
    • Debian-based platforms
      sudo apt-get install python-kerberos
    • Other platforms
      sudo pip install kerberos
  5. Create a cqlshrc file in ~/.cassandra or client program ~/.cassandra directory using the install_location/resources/cassandra/conf/cqlshrc.sample.kerberos file.
  6. Specify the hostname when you login. When using Kerberos, the host is required.
    cqlsh options host port