Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Beeline file name parameterize

avatar
New Contributor

I have a directory of say 10 SQL files and out of which I need to run only 5 SQL files. I am trying to achieve this by creating an array of only the five files that I need to execute and trying to call Beeline -f in for loop to execute the files . But the solution does not seem to be working . The SQL can be triggered when I run beeline -f mysqlfile.sql  

 

for eachline in "${testarray[@]}"
do
beeline -f '${eachline}'.sql
done

 

2 REPLIES 2

avatar

@Caliber ,

 

Not sure if this is the problem, but beeline has a known issue with terminal settings when running in the background.

 

Try adding this to your script, before the for loop:

export HADOOP_OPTS=-Djline.terminal=jline.UnsupportedTerminal

 

Cheers,

André

 

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
Expert Contributor

@Caliber The following command should work:

# for hql in {a.hql,b.hql}; do beeline -n hive -p password --showheader=false --silent=true -f $hql; done