5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-04 00:43:42 +08:00

SQOOP-832: Document --columns argument usage in export tool

(Qian Xu via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2014-07-10 20:38:54 -07:00
parent efda8ddca4
commit d46833b646
2 changed files with 21 additions and 4 deletions

View File

@ -27,6 +27,9 @@ include::common-args.txt[]
Export control options
~~~~~~~~~~~~~~~~~~~~~~
--columns (col-names)::
Columns to export to table
--direct::
Use direct import fast path (MySQL)

View File

@ -48,6 +48,7 @@ include::validation-args.txt[]
`----------------------------------------`------------------------------
Argument Description
------------------------------------------------------------------------
+\--columns <col,col,col...>+ Columns to export to table
+\--direct+ Use direct export fast path
+\--export-dir <dir>+ HDFS source path for the export
+-m,\--num-mappers <n>+ Use 'n' map tasks to export in\
@ -77,9 +78,18 @@ Argument Description
------------------------------------------------------------------------
The +\--export-dir+ argument and one of +\--table+ or +\--call+ are
required. These specify the table to populate in the database (or the
stored procedure to call), and the directory in HDFS that contains
the source data.
required. These specify the table to populate in the database (or the
stored procedure to call), and the directory in HDFS that contains
the source data.
By default, all columns within a table are selected for export. 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 export. For example: +\--columns "col1,col2,col3"+. Note
that columns that are not included in the +--columns+ parameter need
to have either defined default value or allow +NULL+ values. Otherwise
your database will reject the imported data which in turn will make
Sqoop job fail.
You can control the number of mappers independently from the number of
files present in the directory. Export performance depends on the
@ -266,6 +276,11 @@ Sqoop attempts to insert rows which violate constraints in the database
(for example, a particular primary key value already exists), then the export
fails.
Alternatively, you can specify the columns to be exported by providing
+--columns "col1,col2,col3"+. Please note that columns that are not included
in the +--columns+ parameter need to have either defined default value or
allow +NULL+ values. Otherwise your database will reject the imported data
which in turn will make Sqoop job fail.
Another basic export to populate a table named +bar+ with validation enabled:
<<validation,More Details>>
@ -282,4 +297,3 @@ An export that calls a stored procedure named +barproc+ for every record in
$ sqoop export --connect jdbc:mysql://db.example.com/foo --call barproc \
--export-dir /results/bar_data
----