sqoop - Sqoop Create Hive Table - apache sqoop - sqoop tutorial - sqoop hadoop



How to create hive table sqoop?

The CREATE TABLE statement creates a Hive table. ... You must specify the list of columns that are to be created as non-partitioned columns in the table. Each column is specified as a column name and data type (all valid Big SQL data types are allowed).

Purpose of create hive table?

The create-hive-table tool populates a Hive metastore with a definition for a table based on a database table previously imported to HDFS, or one planned to be imported. This effectively performs the "--hive-import" step of sqoop-import without running the preceeding import.

If data was already loaded to HDFS, you can use this tool to finish the pipeline of importing the data to Hive. You can also create Hive tables with this tool; data then can be imported and populated into the target after a preprocessing step run by the user.

Syntax

$ sqoop create-hive-table (generic-args) (create-hive-table-args)
$ sqoop-create-hive-table (generic-args) (create-hive-table-args)
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team

Although the Hadoop generic arguments must preceed any create-hive-table arguments, the create-hive-table arguments can be entered in any order with respect to one another.

Hive arguments:

Argument Description
--hive-home Override $HIVE_HOME
--hive-overwrite Overwrite existing data in the Hive table.
--create-hive-table If set, then the job will fail if the target hive
table exits. By default this property is false.
--hive-table <table-name> Sets the table name to use when importing to Hive.
--table The database table to read the definition from.

Output line formatting arguments:

Argument Description
--hive-home Override $HIVE_HOME
--hive-overwrite Overwrite existing data in the Hive table.
--create-hive-table If set, then the job will fail if the target hive
table exits. By default this property is false.
--hive-table <table-name> Sets the table name to use when importing to Hive.
--table The database table to read the definition from.
  • Do not use enclosed-by or escaped-by delimiters with output formatting arguments used to import to Hive. Hive cannot currently parse them.

Example

  • Define in Hive a table named emps with a definition based on a database table named wikitechy_employees:
$ sqoop create-hive-table --connect jdbc:mysql://db.example.com/corp \
    --table wikitechy_employees --hive-table emps
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team


Related Searches to Sqoop Create Hive Table