Created 10-13-2021 08:38 AM
I'm trying to sqoop some tables from Postgres to Hive and convert them to ORC while sqooping.
1. I used the below command.
sqoop import --hcatalog-home /usr/hdp/current/hive-webhcat --connect jdbc:postgresql://<host>/<database> --username user --password pwd --table table --hcatalog-database default --hcatalog-table table --hcatalog-storage-stanza "stored as orcfile" --create-hcatalog-table -m 1
I was getting the below error:
ERROR tool.ImportTool: Import failed: org.apache.hive.hcatalog.common.HCatException : 2016 : Error operation not supported : Store into a transactional table default.agent from Pig/Mapreduce is not supported
2. I changed the sqoop to look like this.
sqoop import --hcatalog-home /usr/hdp/current/hive-webhcat --connect jdbc:postgresql://<host>/<database> --username user --password pwd --table table --hcatalog-database default --hcatalog-table table --hcatalog-storage-stanza "stored as orcfile tblproperties (\"transactional\"=\"false\")" --create-hcatalog-table -m 1
Error:
3. and I added the below after some googling,
sqoop import --hcatalog-home /usr/hdp/current/hive-webhcat --connect jdbc:postgresql://<host>/<database> --username user --password pwd --table table --hcatalog-database default --hcatalog-table table --hcatalog-storage-stanza "stored as orcfile tblproperties (\"transactional\"=\"false\")" --create-hcatalog-table --hcatalog-external-table -m 1
sqoop import --hcatalog-home /usr/hdp/current/hive-webhcat --connect jdbc:postgresql://<host>/<database> --username user --password pwd --table table --hcatalog-database default --hcatalog-external-table table --hcatalog-storage-stanza "stored as orcfile tblproperties (\"transactional\"=\"false\")" --create-hcatalog-table -m 1
I tried both given above,
This is the Error:
Created 10-14-2021 02:51 AM
Hello,
Please try to run the sqoop command as below and let us know how it goes:-
$ sqoop import --connect jdbc:mysql://localhost/employees --username hive --password hive --table departments --hcatalog-database default --hcatalog-table my_table_orc --create-hcatalog-table --hcatalog-storage-stanza "stored as orcfile"
Created 10-14-2021 03:03 AM
Hi COE,
I don't get what you changed,
But, I got the below error
ERROR tool.ImportTool: Import failed: No primary key could be found for table dup_07jul. Please specify one with --split-by or perform a sequential import with '-m 1'.
after adding '-m 1', I got
ERROR tool.ImportTool: Import failed: org.apache.hive.hcatalog.common.HCatException : 2016 : Error operation not supported : Store into a transactional table default.duplicates_1 from Pig/Mapreduce is not supported
Created 10-14-2021 03:41 AM
Hello,
Please try the below command and let us know:-
$ sqoop import --connect jdbc:mysql://localhost/employees --username hive --password hive --table departments --hcatalog-database default --hcatalog-table my_table_orc --create-hcatalog-table --hcatalog-storage-stanza --hcatalog-storage-stanza "stored as orc tblproperties (\"transactional\"=\"false\")"
If it doesn’t work then the workaround is the two step process.
1. Create the ORC table in hive with the keyword external and set transactional to false
2. Then use the sqoop command to load the data into the orc table.
Created 10-14-2021 03:46 AM
No, that's not working for me. I already mentioned the error in question.
https://git-wip-us.apache.org/repos/asf?p=sqoop.git;a=blob;f=src/docs/user/hcatalog.txt;h=96a90f75ca...
in reference to above link, can you please tell me why --hcatalog-external-table is not working??
The workaround is good, but I have many tables to move and it may not be easy for me to do the table creation manually.