Write based on Monster group and GPT:
Use Sqoop import command to import Oracle table structure into Hive. Here is an example command:
sqoop import \
--connect jdbc:oracle:thin:@:: \
--username \
--password \
--table \
--hive-import \
--hive-table \
--create-hive-table \
--hive-overwrite \
--query 'SELECT * FROM WHERE 1=0' \
--null-string '\\N' \
--null-non-string '\\N'
This command imports the Oracle table structure into the Hive table. The following is the meaning of each parameter in the command:
--connect: Specifies the JDBC connection string for the Oracle database.
--username: specifies the username of the Oracle database.
--password: specifies the password of the Oracle database.
--table: Specifies the name of the Oracle table to import.
--hive-import: Specifies that data is imported to the Hive.
--hive-table: Specifies the Hive table name.
--create-hive-table: If the Hive table does not exist, a new table is created.
--hive-overwrite: If the hive table already exists, the Hive table is overwritten.
--query: Specifies the SQL query to be executed. The query statement here is only used to get the table structure, so the query result is empty.
--null-string: Specifies that an empty string in Oracle is mapped to a NULL value in Hive during data import.
--null-non-string: Specifies that null values in Oracle are mapped to NULL values in Hive when data is imported.
After this command is executed, only an empty table is created in Hive. This table has the same structure as the Oracle table, but no data is imported.