Database Reference
In-Depth Information
in cqlsh's current session
CONSISTENCY <level>
COPY
The COPY command is a handy utility to load data to a table from a file or the command
prompt (standard input). It can also be used to copy data from a table to an external CSV
file or to the command prompt (standard output):
# To copy from a CSV file or stdin
COPY table_name ( column1, column2, …)
FROM ( 'file_name' | STDIN )
[ WITH option = 'value' [ AND option = 'value' [ AND option
= 'value' …]]]
# To copy to a CSV file or stdout
COPY table_name ( column1, column2, …)
TO ( 'file_name' | STDIN )
[ WITH option = 'value' [ AND option = 'value' [ AND option
= 'value' …]]]
The options are described as follows:
HEADER : This option is to inform Cassandra whether the CSV has a header (the
names of the columns) as the first row.
DELIMITER : The character to be used to separate fields in one line. The default
delimiter is a comma.
QUOTE : The character to be used to surround each field value. Any delimiter
within the quotes will not be treated as a delimiter, rather a regular character. The
default is the double quote character.
ESCAPE : The escape character is used to mark any QUOTE character within the
field value as normal character. The default is a backslash.
NULL : This is the string that one uses to represent NULL in text. The default is an
empty string, but one can opt to choose NA or NIL if they wanted to.
ENCODING : This is used by the COPY TO command.
CAPTURE
The CAPTURE command copies the output of a query to the file specified:
Search WWH ::




Custom Search