Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Solved
Go to solution
How to check the existence of the table in Beeline Hive using shell script
Labels:
- Labels:
-
Apache Hive
Rising Star
Created ‎01-08-2018 05:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1 ACCEPTED SOLUTION
Super Guru
Created ‎01-08-2018 07:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use the below script .
beeline -u "{connection-string}" -e "show tables" | grep $1 if [ $? -eq 0 ] then echo "table found" else echo "table not found" fi
But the content in a file say checktable.sh and run the below steps
chmod +x checktable.sh ./checktable.sh {tablename to check}
Thanks,
Aditya
1 REPLY 1
Super Guru
Created ‎01-08-2018 07:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use the below script .
beeline -u "{connection-string}" -e "show tables" | grep $1 if [ $? -eq 0 ] then echo "table found" else echo "table not found" fi
But the content in a file say checktable.sh and run the below steps
chmod +x checktable.sh ./checktable.sh {tablename to check}
Thanks,
Aditya
