To import all the tables in the database, instead of a single table.
Here "-m 1" tag ensures a sequential import. If not specified, the below exception will be thrown.
ERROR tool.ImportAllTablesTool: Error during import: No primary key could be found for table Category. Please specify one with --split-by or perform a sequential import with '-m 1'.
.............
You may also use hive to view the databases created in cassandra, in an sql-like manner.
When the entire database is imported as above, separate java classes will be created for each of the tables.
$ bin/dse sqoop import-all-tables -m 1 --connect jdbc:mysql://127.0.0.1:3306/shopping_cart_db --username root --password root --cassandra-thrift-host localhost --cassandra-create-schema --direct
12/06/15 15:42:11 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
12/06/15 15:42:11 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
12/06/15 15:42:11 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:42:11 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `Category` AS t LIMIT 1
12/06/15 15:42:11 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Category.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:42:13 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Category.jar
12/06/15 15:42:13 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:42:13 INFO mapreduce.ImportJobBase: Beginning import of Category
12/06/15 15:42:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
12/06/15 15:42:15 INFO mapred.JobClient: Running job: job_201206151241_0007
12/06/15 15:42:16 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:42:25 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:42:25 INFO mapred.JobClient: Job complete: job_201206151241_0007
12/06/15 15:42:25 INFO mapred.JobClient: Counters: 18
12/06/15 15:42:25 INFO mapred.JobClient: Job Counters
12/06/15 15:42:25 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=6480
12/06/15 15:42:25 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:42:25 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:42:25 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:42:25 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:42:25 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:42:25 INFO mapred.JobClient: Bytes Written=2848
12/06/15 15:42:25 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:42:25 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21419
12/06/15 15:42:25 INFO mapred.JobClient: CFS_BYTES_WRITTEN=2848
12/06/15 15:42:25 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:42:25 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:42:25 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:42:25 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:42:25 INFO mapred.JobClient: Map input records=1
12/06/15 15:42:25 INFO mapred.JobClient: Physical memory (bytes) snapshot=119435264
12/06/15 15:42:25 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:42:25 INFO mapred.JobClient: CPU time spent (ms)=630
12/06/15 15:42:25 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:42:25 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2085318656
12/06/15 15:42:25 INFO mapred.JobClient: Map output records=36
12/06/15 15:42:25 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:42:25 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 11.4492 seconds (0 bytes/sec)
12/06/15 15:42:25 INFO mapreduce.ImportJobBase: Retrieved 36 records.
12/06/15 15:42:25 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:42:25 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `Customer` AS t LIMIT 1
12/06/15 15:42:25 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Customer.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:42:25 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Customer.jar
12/06/15 15:42:26 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:42:26 INFO mapreduce.ImportJobBase: Beginning import of Customer
12/06/15 15:42:26 INFO mapred.JobClient: Running job: job_201206151241_0008
12/06/15 15:42:27 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:42:35 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:42:35 INFO mapred.JobClient: Job complete: job_201206151241_0008
12/06/15 15:42:35 INFO mapred.JobClient: Counters: 17
12/06/15 15:42:35 INFO mapred.JobClient: Job Counters
12/06/15 15:42:35 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=6009
12/06/15 15:42:35 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:42:35 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:42:35 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:42:35 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:42:35 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:42:35 INFO mapred.JobClient: Bytes Written=0
12/06/15 15:42:35 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:42:35 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21489
12/06/15 15:42:35 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:42:35 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:42:35 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:42:35 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:42:35 INFO mapred.JobClient: Map input records=1
12/06/15 15:42:35 INFO mapred.JobClient: Physical memory (bytes) snapshot=164855808
12/06/15 15:42:35 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:42:35 INFO mapred.JobClient: CPU time spent (ms)=510
12/06/15 15:42:35 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:42:35 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2082869248
12/06/15 15:42:35 INFO mapred.JobClient: Map output records=0
12/06/15 15:42:35 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:42:35 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 9.3143 seconds (0 bytes/sec)
12/06/15 15:42:35 INFO mapreduce.ImportJobBase: Retrieved 0 records.
12/06/15 15:42:35 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:42:35 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `OrderEntry` AS t LIMIT 1
12/06/15 15:42:35 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/OrderEntry.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:42:35 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/OrderEntry.jar
12/06/15 15:42:36 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:42:36 INFO mapreduce.ImportJobBase: Beginning import of OrderEntry
12/06/15 15:42:36 INFO mapred.JobClient: Running job: job_201206151241_0009
12/06/15 15:42:37 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:42:45 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:42:45 INFO mapred.JobClient: Job complete: job_201206151241_0009
12/06/15 15:42:45 INFO mapred.JobClient: Counters: 17
12/06/15 15:42:45 INFO mapred.JobClient: Job Counters
12/06/15 15:42:45 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=6381
12/06/15 15:42:45 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:42:45 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:42:45 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:42:45 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:42:45 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:42:45 INFO mapred.JobClient: Bytes Written=0
12/06/15 15:42:45 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:42:45 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21569
12/06/15 15:42:45 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:42:45 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:42:45 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:42:45 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:42:45 INFO mapred.JobClient: Map input records=1
12/06/15 15:42:45 INFO mapred.JobClient: Physical memory (bytes) snapshot=137252864
12/06/15 15:42:45 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:42:45 INFO mapred.JobClient: CPU time spent (ms)=520
12/06/15 15:42:45 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:42:45 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2014703616
12/06/15 15:42:45 INFO mapred.JobClient: Map output records=0
12/06/15 15:42:45 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:42:45 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 9.2859 seconds (0 bytes/sec)
12/06/15 15:42:45 INFO mapreduce.ImportJobBase: Retrieved 0 records.
12/06/15 15:42:45 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:42:45 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `OrderItem` AS t LIMIT 1
12/06/15 15:42:45 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/OrderItem.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:42:45 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/OrderItem.jar
12/06/15 15:42:46 WARN manager.CatalogQueryManager: The table OrderItem contains a multi-column primary key. Sqoop will default to the column orderNumber only for this job.
12/06/15 15:42:46 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:42:46 INFO mapreduce.ImportJobBase: Beginning import of OrderItem
12/06/15 15:42:46 INFO mapred.JobClient: Running job: job_201206151241_0010
12/06/15 15:42:47 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:42:55 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:42:55 INFO mapred.JobClient: Job complete: job_201206151241_0010
12/06/15 15:42:55 INFO mapred.JobClient: Counters: 17
12/06/15 15:42:55 INFO mapred.JobClient: Job Counters
12/06/15 15:42:55 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=5949
12/06/15 15:42:55 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:42:55 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:42:55 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:42:55 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:42:55 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:42:55 INFO mapred.JobClient: Bytes Written=0
12/06/15 15:42:55 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:42:55 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21524
12/06/15 15:42:55 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:42:55 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:42:55 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:42:55 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:42:55 INFO mapred.JobClient: Map input records=1
12/06/15 15:42:55 INFO mapred.JobClient: Physical memory (bytes) snapshot=116674560
12/06/15 15:42:55 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:42:55 INFO mapred.JobClient: CPU time spent (ms)=590
12/06/15 15:42:55 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:42:55 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2014703616
12/06/15 15:42:55 INFO mapred.JobClient: Map output records=0
12/06/15 15:42:55 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:42:55 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 9.2539 seconds (0 bytes/sec)
12/06/15 15:42:55 INFO mapreduce.ImportJobBase: Retrieved 0 records.
12/06/15 15:42:55 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:42:55 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `Payment` AS t LIMIT 1
12/06/15 15:42:55 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Payment.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:42:55 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Payment.jar
12/06/15 15:42:56 WARN manager.CatalogQueryManager: The table Payment contains a multi-column primary key. Sqoop will default to the column orderNumber only for this job.
12/06/15 15:42:56 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:42:56 INFO mapreduce.ImportJobBase: Beginning import of Payment
12/06/15 15:42:56 INFO mapred.JobClient: Running job: job_201206151241_0011
12/06/15 15:42:57 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:43:05 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:43:05 INFO mapred.JobClient: Job complete: job_201206151241_0011
12/06/15 15:43:05 INFO mapred.JobClient: Counters: 17
12/06/15 15:43:05 INFO mapred.JobClient: Job Counters
12/06/15 15:43:05 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=5914
12/06/15 15:43:05 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:43:05 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:43:05 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:43:05 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:43:05 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:43:05 INFO mapred.JobClient: Bytes Written=0
12/06/15 15:43:05 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:43:05 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21518
12/06/15 15:43:05 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:43:05 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:43:05 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:43:05 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:43:05 INFO mapred.JobClient: Map input records=1
12/06/15 15:43:05 INFO mapred.JobClient: Physical memory (bytes) snapshot=137998336
12/06/15 15:43:05 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:43:05 INFO mapred.JobClient: CPU time spent (ms)=520
12/06/15 15:43:05 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:43:05 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2082865152
12/06/15 15:43:05 INFO mapred.JobClient: Map output records=0
12/06/15 15:43:05 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:43:05 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 9.2642 seconds (0 bytes/sec)
12/06/15 15:43:05 INFO mapreduce.ImportJobBase: Retrieved 0 records.
12/06/15 15:43:05 INFO tool.CodeGenTool: Beginning code generation
12/06/15 15:43:05 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `Product` AS t LIMIT 1
12/06/15 15:43:06 INFO orm.CompilationManager: HADOOP_HOME is /home/pradeeban/programs/dse-2.1/resources/hadoop/bin/..
Note: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Product.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
12/06/15 15:43:06 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-pradeeban/compile/926ddf787c73be06c4e2ad1f8fc522f1/Product.jar
12/06/15 15:43:06 INFO manager.DirectMySQLManager: Beginning mysqldump fast path import
12/06/15 15:43:06 INFO mapreduce.ImportJobBase: Beginning import of Product
12/06/15 15:43:07 INFO mapred.JobClient: Running job: job_201206151241_0012
12/06/15 15:43:08 INFO mapred.JobClient: map 0% reduce 0%
12/06/15 15:43:16 INFO mapred.JobClient: map 100% reduce 0%
12/06/15 15:43:16 INFO mapred.JobClient: Job complete: job_201206151241_0012
12/06/15 15:43:16 INFO mapred.JobClient: Counters: 18
12/06/15 15:43:16 INFO mapred.JobClient: Job Counters
12/06/15 15:43:16 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=5961
12/06/15 15:43:16 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
12/06/15 15:43:16 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
12/06/15 15:43:16 INFO mapred.JobClient: Launched map tasks=1
12/06/15 15:43:16 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
12/06/15 15:43:16 INFO mapred.JobClient: File Output Format Counters
12/06/15 15:43:16 INFO mapred.JobClient: Bytes Written=248262
12/06/15 15:43:16 INFO mapred.JobClient: FileSystemCounters
12/06/15 15:43:16 INFO mapred.JobClient: FILE_BYTES_WRITTEN=21527
12/06/15 15:43:16 INFO mapred.JobClient: CFS_BYTES_WRITTEN=248262
12/06/15 15:43:16 INFO mapred.JobClient: CFS_BYTES_READ=87
12/06/15 15:43:16 INFO mapred.JobClient: File Input Format Counters
12/06/15 15:43:16 INFO mapred.JobClient: Bytes Read=0
12/06/15 15:43:16 INFO mapred.JobClient: Map-Reduce Framework
12/06/15 15:43:16 INFO mapred.JobClient: Map input records=1
12/06/15 15:43:16 INFO mapred.JobClient: Physical memory (bytes) snapshot=144871424
12/06/15 15:43:16 INFO mapred.JobClient: Spilled Records=0
12/06/15 15:43:16 INFO mapred.JobClient: CPU time spent (ms)=1030
12/06/15 15:43:16 INFO mapred.JobClient: Total committed heap usage (bytes)=121241600
12/06/15 15:43:16 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2085318656
12/06/15 15:43:16 INFO mapred.JobClient: Map output records=300
12/06/15 15:43:16 INFO mapred.JobClient: SPLIT_RAW_BYTES=87
12/06/15 15:43:16 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 9.2613 seconds (0 bytes/sec)
12/06/15 15:43:16 INFO mapreduce.ImportJobBase: Retrieved 300 records.
I found DataStax an interesting project to explore more. I have blogged on the issues that I faced on this as a learner, and how easily can they be fixed -
.