Sqoop reference

Use the dse sqoop command to import SQL data into CQL, export SQL data to SQL, and import Thrift/CLI data to CQL.

DataStax Enterprise supports three forms of the dse sqoop command for use with Sqoop:

$ dse sqoop <action> --connect <jdbc url> --cassandra-keyspace <ks> --cassandra-table <cf> --cassandra-host <host> --table <sql table>

where <action>, is one of the following keywords:

  • Import SQL data into CQL:
    cql-import
  • Export SQL data to CQL.
    cql-export
  • Import Thrift/CLI data to CQL.
    thrift-import

The following tables list cql-import and -export command options. You can use most options to either import or export data. Exceptions are noted in the option description.

cql-import and cql-export Cluster Options
Command Description
--cassandra-consistency-level <consistencylevel> The Cassandra consistency level, which is LOCAL_ONE by default
--cassandra-host <host> A comma separated list of Cassandra hosts
--cassandra-partitioner <partitioner> The Cassandra partitioner, which is Murmur3Partitioner by default
--cassandra-port <port> The Cassandra port
cql-import and cql-export Data Options
Command Description
--query <sql query> Supports importing SQL joins.
--cassandra-column-mapping map

... where map = cql1:sql1,cql2:sql2

... CQLLISTSET:[SQLCOL,SQLCOL,SQLCOL]

... CQLMAP:[SQLCOL:VALCOL,SQLCOL:VALCOL]

Supports mapping ambiguous columns for import/export.
Maps cql and sql columns (not collections) for import/export.
Maps a list or set type for import/export.
Handles importing/exporting of a map type.
--cassandra-page-size cql-export only. Limits the page size of columns selected for export.
--cassandra-select-columns cql-export only. Select the named columns to export.
--cassandra-where-clause cql-export only. Filter the data selected for export based on the where condition.
cql-import and cql-export Security Options
Command Description
--cassandra-enable-kerberos Enables kerberos authentication
--cassandra-kerberos-config-path <jaas.config path> Path to the users jaas.config file
--cassandra-enable-ssl Enables SSL transport
--cassandra-ssl-protocol <protocol> Configures the SSL protocol
--cassandra-truststore-algo <algo> Configures the SSL trust store algorithm
--cassandra-truststore-ciphers <ciphers> Configures the SSL trust store ciphers
--cassandra-truststore-location <location> Path to the SSL trust store
--cassandra-truststore-password <passwd> Configures the SSL trust store password
--cassandra-truststore-type <type> Configures the SSL trust store type
--cassandra-username <username> Used for password authentication, which works only with the local jobtracker
--cassandra-password <password> Used for password authentication
--cassandra-kerberos-service-principal <service principal> The Kerberos principal for which you have created a ticket using kinit
Allowable data type conversions for importing SQL to CQL
SQL Type CQL Type
VARCHAR text, ascii, varchar
BIT boolean, text, ascii, varchar
BIT(1) boolean, text, ascii, varchar
BIT(>1) blob
TINYINT int, bigint, varint, float, double, decimal, text, ascii, varchar
SMALLINT int, bigint, varint, float, double, decimal, text, ascii, varchar
INTEGER int, bigint, varint, float, double, decimal, text, ascii, varchar
BIGINT bigint, varint, float, double, decimal, text, ascii, varchar
FLOAT float, double, decimal, text, ascii, varchar
DOUBLE double, decimal, text, ascii, varchar
DECIMAL decimal, text, ascii, varchar
NUMERIC decimal, text, ascii, varchar
BLOB blob
CLOB blob, text, ascii, varchar
BINARY(n) blob, text, ascii, varchar
VARBINARY(n) blob, text, ascii, varchar
DATE timestamp, text, ascii, varchar
TIME timestamp, text, ascii, varchar
TIMESTAMP timestamp, text, ascii, varchar
Data type map for exporting CQL to SQL
CQL Type SQL Type
int TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL, NUMERIC, VARCHAR
bigint BIGINT, FLOAT, DOUBLE, DECIMAL, NUMERIC, VARCHAR
varint DECIMAL, NUMERIC, VARCHAR
float FLOAT, DOUBLE, DECIMAL, NUMERIC, VARCHAR
double DOUBLE, DECIMAL, NUMERIC, VARCHAR
decimal DECIMAL, NUMERIC, VARCHAR
ascii VARCHAR, CLOB, BLOB, VARBINARY
text VARCHAR, CLOB, BLOB, VARBINARY
varchar VARCHAR, CLOB, BLOB, VARBINARY
timestamp DATE, TIME, TIMESTAMP, VARCHAR
boolean BOOLEAN, BIT, BIT(1), VARCHAR
blob BLOB, VARBINARY
inet VARCHAR
uuid VARCHAR
timeuuid VARCHAR