Created on 06-28-2017 03:32 PM - edited 09-16-2022 04:51 AM
When importing data from Postgres using Sqoop, I get the following error:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:User user1 does not have privileges for CREATETABLE)
However when I use beeline, I am able to create tables using user1. However, if I start the old hive-cli I get the exact same error as above. Is there a way to make sqoop use beeline vs the old hive to create the tables?
On CDH 5.11.1, with Sentry enabled.
Created 06-28-2017 04:10 PM
Can you share your sqoop script (or) confirm you are using "--hive-database dbname" ?
because if you sqoop import without above condition, it may try to create & import in default DB where user1 won't have create privilege.
but with beeline, you would have used dbname when you login where user1 have access to create/import table
beeline -u "jdbc:hive2://hostname:10000/dbname;principal...."
so you may feel that beeline works differently than normal hive
Created 06-28-2017 04:17 PM
Created 06-28-2017 05:10 PM
Couple of recommendations,
1. you are using default db... if possible, use a different DB instead of default, it may help you
(or)
2. Follow below steps to understand the privilege that user1 has on default DB
Run this command in Linux: and get the groups that user belongs to...
$ id <userid>
Login to beeline and run the following commands:
# The below command will show the Roles that belongs to group. Get the group_name from above cmd
beeline> SHOW ROLE GRANT GROUP group_name;
# The below command will show the Roles that has access on databases. Get role_name from above cmd
beeline> SHOW GRANT ROLE role_name;
You can also do this Hue if you have access. This will help you to identify the user1 access on a particular DB.
Created 06-28-2017 07:59 PM
Created 06-28-2017 08:07 PM
Created 06-29-2017 11:32 AM
Thanks for your help. It turned out that the data nodes did not have the group configured correctly for user1 and that was causing the issue. After that was configured correctly and restarted it worked fine.