mirror of
https://github.com/apache/sqoop.git
synced 2025-05-06 10:01:30 +08:00
SQOOP-832: Document --columns argument usage in export tool
(Qian Xu via Jarek Jarcec Cecho)
This commit is contained in:
parent
efda8ddca4
commit
d46833b646
@ -27,6 +27,9 @@ include::common-args.txt[]
|
|||||||
Export control options
|
Export control options
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
--columns (col-names)::
|
||||||
|
Columns to export to table
|
||||||
|
|
||||||
--direct::
|
--direct::
|
||||||
Use direct import fast path (MySQL)
|
Use direct import fast path (MySQL)
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ include::validation-args.txt[]
|
|||||||
`----------------------------------------`------------------------------
|
`----------------------------------------`------------------------------
|
||||||
Argument Description
|
Argument Description
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
+\--columns <col,col,col...>+ Columns to export to table
|
||||||
+\--direct+ Use direct export fast path
|
+\--direct+ Use direct export fast path
|
||||||
+\--export-dir <dir>+ HDFS source path for the export
|
+\--export-dir <dir>+ HDFS source path for the export
|
||||||
+-m,\--num-mappers <n>+ Use 'n' map tasks to export in\
|
+-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
|
The +\--export-dir+ argument and one of +\--table+ or +\--call+ are
|
||||||
required. These specify the table to populate in the database (or the
|
required. These specify the table to populate in the database (or the
|
||||||
stored procedure to call), and the directory in HDFS that contains
|
stored procedure to call), and the directory in HDFS that contains
|
||||||
the source data.
|
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
|
You can control the number of mappers independently from the number of
|
||||||
files present in the directory. Export performance depends on the
|
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
|
(for example, a particular primary key value already exists), then the export
|
||||||
fails.
|
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:
|
Another basic export to populate a table named +bar+ with validation enabled:
|
||||||
<<validation,More Details>>
|
<<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 \
|
$ sqoop export --connect jdbc:mysql://db.example.com/foo --call barproc \
|
||||||
--export-dir /results/bar_data
|
--export-dir /results/bar_data
|
||||||
----
|
----
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user