NOTICE You can export data out of tables only as a user who has the EXPORT privilege on those tables. If you do not have the EXPORT privilege, follow the instructions provided in GRANT to grant the EXPORT privilege to the user that you use to connect to your cluster.
Syntax
Parameters
-
table_nameThe name of the table. The database supports exporting the data of tables whoseengineisolapormysql. -
partition_nameThe partitions from which you want to export data. By default, if you do not specify this parameter, the database exports the data from all partitions of the table. -
column_nameThe columns from which you want to export data. The sequence of columns that you specify by using this parameter can differ from the schema of the table. By default, if you do not specify this parameter, the database exports the data from all columns of the table. -
export_pathThe location to which you want to export the data of the table. If the location contains a path, make sure that the path ends with a slash (/). Otherwise, the part following the last slash (/) in the path will be used as the prefix to the name of the exported file. By default,data_is used as the file name prefix if no file name prefix is specified. -
opt_propertiesOptional properties that you can configure for the export task. Syntax: -
WITH BROKERIn v2.4 and earlier, inputWITH BROKER "<broker_name>"to specify the broker you want to use. From v2.5 onwards, you no longer need to specify a broker, but you still need to retain theWITH BROKERkeyword. -
broker_propertiesThe information that is used to authenticate the source data. The authentication information varies depending on the data source. For more information, see BROKER LOAD.
Examples
Export all data of a table to HDFS
The following example exports all data of thetestTbl table to the hdfs://<hdfs_host>:<hdfs_port>/a/b/c/ path of an HDFS cluster:
Export the data of specified partitions of a table to HDFS
The following example exports the data of two partitions,p1 and p2, of the testTbl table to the hdfs://<hdfs_host>:<hdfs_port>/a/b/c/ path of an HDFS cluster:
Export all data of a table to HDFS with column separator specified
The following example exports all data of thetestTbl table to the hdfs://<hdfs_host>:<hdfs_port>/a/b/c/ path of an HDFS cluster and specifies that commas (,) is used as the column separator:
testTbl table to the hdfs://<hdfs_host>:<hdfs_port>/a/b/c/ path of an HDFS cluster and specifies that \x01 (the default column separator supported by Hive) is used as the column separator:
Export all data of a table to HDFS with file name prefix specified
The following example exports all data of thetestTbl table to the hdfs://<hdfs_host>:<hdfs_port>/a/b/c/ path of an HDFS cluster and specifies that testTbl_ is used as the prefix to the name of the exported file:
Export data to AWS S3
The following example exports all data of thetestTbl table to the s3-package/export/ path of an AWS S3 bucket: