SOURCE
Executes a file containing CQL statements.
The output of each statement is shown in the standard output (STDOUT), including error messages.
You can use IF NOT EXISTS
to suppress errors for some statements, such as CREATE KEYSPACE
.
All statements in the file are executed, even if a no-operation error occurs.
Synopsis
SOURCE '<file_name>'
Syntax legend
Syntax conventions | Description |
---|---|
UPPERCASE |
Literal keyword. |
Lowercase |
Not literal. |
|
Variable value. Replace with a user-defined value. |
|
Optional.
Square brackets ( |
|
Group.
Parentheses ( |
|
Or.
A vertical bar ( |
|
Repeatable.
An ellipsis ( |
|
Single quotation ( |
|
Map collection.
Braces ( |
Set, list, map, or tuple.
Angle brackets ( |
|
|
End CQL statement.
A semicolon ( |
|
Separate the command line options from the command arguments with two hyphens ( |
|
Search CQL only: Single quotation marks ( |
|
Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files. |
- <file_name>
-
Name of the file to execute. Specify the path of the file relative to the current directory, which is the directory where cqlsh was started on your local computer. Enclose the file name in single quotation marks. Use tilde (~) for your home directory.
Examples
Execute CQL statements from a file:
SOURCE '~/cycling_setup/create_ks_and_tables.cql'
To execute a CQL file without starting a shell session, use |