Sqoop with Postgresql
Download the Postgresql connector jar and store in lib directory present in sqoop home folder.
List the database ,
sqoop-list-databases --connect jdbc:postgresql://localhost:5432/ --username postgres --password ""
List the Tables from database ,
sqoop-list-tables --connect jdbc:postgresql://localhost:5432/ --username postgres --password ""
Import Postgresql database in to HIVE
root@mahesh:/data# sqoop-import --connect jdbc:postgresql://localhost:5432/db1 -username postgres -password "" --table tb1 --hive-table tablename --create-hive-table --hive-import -m 1
List the data in file
root@mahesh:/data# hadoop fs -cat /user/hive/warehouse/tb1/part-m-00000
* Suppose multiple schema's tables in postgresql database you need set your search_path in Postgres,
ALTER ROLE sqoopuser SET search_path TO customschema,public;