Thursday, 28 March 2019

shell script to find file availability

if [ -f jan_demo_text.txt ]  #checking file availability
then
    if [ -s jan_demo_text.txt ]
    then  #data available means do it
        echo "data available"
    else  #file empty means do it.
        echo "File exists but empty"
exit
   fi
else
    echo "File not exists"

fi


Monday, 18 March 2019

import mysql table into hive using sqoop

sqoop import \
--connect jdbc:mysql://ms.rawdatahp.com:3306/retail_db \
--username retail_user \
--password itversity \
--split-by department_id \
--table departments \
--hive-database wallstreet \
--hive-import \
--create-hive-table \
--hive-table departmentshive -m 1