public class CopyToCommandExecutor extends AbstractCopyCommandExecutor
COPY <tableName>[(<columns>)] TO <target>[ WITH <options>[ AND <options> ...]]: where tableName
is the name of the table to copy (it may be prefixed with the keyspace name), columns is a subset of
columns to copy specified by adding a comma-separated list of column names, target is a string literal
(with single quotes) representing the path to the destination file; and options are the options among
the following:
DECIMALSEP: the character that is used as the decimal point separator.
Defaults to .DELIMITER: the character that is used to separate fields.
Defaults to .ESCAPE: the character that is used to escape the literal uses of the QUOTE character.
Defaults to .HEADER: whether the first line in the CSV output file will contain the column names.
Defaults to false.NULLVAL: the string placeholder for null values. Defaults to .PAGESIZE: the number of rows to fetch in a single page.
Defaults to if not specified or if the given value is not a valid integer.QUOTE: the character that is used to enclose field values.
Defaults to .THOUSANDSSEP: the character that is used to separate thousands.
Defaults to the empty string.
If the path to the destination file is not absolute, it is interpreted relative to the current working
directory. The tilde shorthand notation ('~/dir') is supported for referring to the home directory.
The format to define the value of an option is: <optionName> = <value>. The value must be quoted if it
is a string literal.
The following options are not supported:
BEGINTOKENBOOLSTYLECONFIGFILEDATETIMEFORMATENCODINGENDTOKENMAXATTEMPTSMAXOUTPUTSIZEMAXREQUESTSNULL (use NULLVAL instead)NUMPROCESSESPAGETIMEOUTRATEFILEREPORTFREQUENCYSQLSyntaxErrorException.
A successful command execution will return a result set with a single row containing some information about the
export process in a column result.
The documentation of the original COPY TO command is available:
| Constructor and Description |
|---|
CopyToCommandExecutor(String tableName,
String columns,
String target,
Properties options)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.datastax.oss.driver.api.core.cql.ResultSet |
execute(CassandraStatement statement,
String cql)
Executes the given CQL statement as a special command not handled by the Java driver.
|
public CopyToCommandExecutor(@Nonnull String tableName, String columns, @Nonnull String target, @Nonnull Properties options) throws SQLSyntaxErrorException
tableName - The parameter tableName of the command.columns - The optional parameter columns of the command.target - The parameter target of the command.options - The optional parameter options of the command already parsed into a Properties
instance.SQLSyntaxErrorException - if an unknown option is used.public com.datastax.oss.driver.api.core.cql.ResultSet execute(CassandraStatement statement, String cql) throws SQLException
statement - The Cassandra statement.cql - The CQL statement to execute.SpecialCommandsUtil.buildEmptyResultSet()) if the command is not expected to return some results.SQLException - if something went wrong with the Cassandra statement.Copyright © 2020–2026 ING Bank. All rights reserved.