mysql的数据比较多,只想导入一部分,sqoop导入是不是不能自由设定行键?
java程序怎么导入呢?
sqoop可以选择一部分导入:7.2.2. Selecting the Data to Import
Sqoop typically imports data in a table-centric fashion. Use the --table argument to select the table to import. For example, --table employees. This argument can also identify a VIEW or other table-like entity in a database.
By default, all columns within a table are selected for import. Imported data is written to HDFS in its "natural order;" that is, a table containing columns A, B, and C result in an import of data such as:
A1,B1,C1
A2,B2,C2
...
You can select a subset of columns and control their ordering by using the --columns argument. This should include a comma-delimited list of columns to import. For example: --columns "name,employee_id,jobtitle".
You can control which rows are imported by adding a SQL WHERE clause to the import statement. By default, Sqoop generates statements of the form SELECT FROM . You can append a WHERE clause to this with the --where argument. For example: --where "id > 400". Only rows where the id column has a value greater than 400 will be imported.
By default sqoop will use query select min(), max() from
url:http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html#_selecting_the_data_to_import