CQL Console
You can use the Cassandra Query Language shell (cqlsh
) utility to issue CQL commands to your database from the command line.
Embedded Astra DB CQL shell
Each Astra DB database has an embedded CQL shell instance in the Astra Portal:
-
In the Astra Portal navigation menu, click your database, and then click CQL Console to open a CQL shell instance connected to your database.
-
Issue CQL commands to your Astra DB database directly in your browser.
To open the CQL Console in a full window, use the following URL:
Replace |
Standalone CQL shell
As an alternative to the embedded CQL shell in the Astra Portal, the standalone CQL shell client is a separate, lightweight tool you can use to interact with your database.
-
If you don’t already have one, create an Astra DB database.
-
Install a Python version with TLS support, which includes versions 2.7.12 or later. For more information, see this DataStax Support article.
-
Download your database’s Secure Connect Bundle (SCB).
-
Generate an application token for your database.
-
Download CQL shell for Astra DB.
-
In the directory where you downloaded the CQL package, extract it:
tar -xvf cqlsh-astra-RELEASE_DATE-bin.tar.gz
Replace
RELEASE_DATE
with the package release date, such as20210304
. -
In the
cqlsh-astra
directory, run thecqlsh
script:cd /cqlsh-astra ./bin/cqlsh -u CLIENT_ID -p CLIENT_SECRET -b PATH_TO_SCB
Replace the following:
-
PATH_TO_SCB
: The path to your database’s SCB zip file -
CLIENT_ID
andCLIENT_SECRET
: Either of the following sets of values from your application token:-
The
clientId
value and thesecret
value -
The literal string
token
and the token secret, prefixed byAstraCS:
-
(Optional) Store credentials in the
cqlshrc
fileIf you don’t want to pass the credentials on the command line every time, you can configure the location in your
cqlshrc
file:-
In the
~/.cassandra
directory, open thecqlshrc
file. -
In the
[authentication]
section, add theCLIENT_ID
andCLIENT_SECRET
values from your application token. -
In the
[connection]
section, add the path to the SCB.
[authentication] username = CLIENT_ID # or the literal string
token
password = CLIENT_SECRET # or the token secret prefixed by 'AstraCS:' [connection] secure_connect_bundle = PATH_TO_SCB -
-
Make sure the command returns output indicating that you connected to your database. For example:
[cqlsh 6.8.0 | DSE 6.8.0.77 | CQL spec 3.4.5 | DSE protocol v2] Use HELP for help. username@cqlsh>
-
Select a keyspace in your database:
USE KEYSPACE_NAME;
-
Issue any required CQL commands to create tables, insert data, and manage database resources within the selected keyspace.