<commit_before>import groovy.sql.Sql

def dbDriver = 'com.amazonaws.athena.jdbc.AthenaDriver'
//change jdbc endpoint below if pointing to any other region
def dbUrl = 'jdbc:awsathena://athena.us-east-1.amazonaws.com:443/awsdatacatalog/'

java.util.Properties props = new Properties();

//script parameters *** Modify as needed ***
props.put("s3_staging_dir", "s3://<<bucket>>/<<prefix>>/");
props.put("user", "<<access key id>>");
props.put("password", "<<secret access key>>");
//end of script parameters

if (args.size() < 2) {
  println "\nUsage: groovy executescript.py <<hive script file>> <<target database>>"
  System.exit(0)
}
def targetfile = new File( args[1] )
if( !targetfile.exists() ) {
  println "Error: File does not exist"
  System.exit(0)
}
dataList = targetfile.text.split( ';' )
print "\nFound "+(dataList.size()-1)+" statements in script...\n"
sql=Sql.newInstance( dbUrl+args[0], props, dbDriver)
dataList.eachWithIndex { elem, i ->
   if (elem.trim()!=";" && elem.trim().size()>0) {
      println "\n"+(i+1)+". Executing :"+elem

      try {<commit_msg>Added constants as per code comments.<commit_after>import groovy.sql.Sql

def dbDriver = 'com.amazonaws.athena.jdbc.AthenaDriver'
//change jdbc endpoint below if pointing to any other region
def dbUrl = 'jdbc:awsathena://athena.us-east-1.amazonaws.com:443/awsdatacatalog/'

java.util.Properties props = new Properties();

//script parameters *** Modify as needed ***
def s3_staging_dir = "s3_staging_dir";
def user = "user";
def password = "password";

props.put(s3_staging_dir, "s3://<<bucket>>/<<prefix>>/");
props.put(user, "<<access key id>>");
props.put(password, "<<secret access key>>");
//end of script parameters

if (args.size() < 2) {
  println "\nUsage: groovy executescript.py <<hive script file>> <<target database>>"
  System.exit(0)
}
def targetfile = new File( args[1] )
if( !targetfile.exists() ) {
  println "Error: File does not exist"
  System.exit(0)
}
dataList = targetfile.text.split( ';' )
print "\nFound "+(dataList.size()-1)+" statements in script...\n"
sql=Sql.newInstance( dbUrl+args[0], props, dbDriver)
dataList.eachWithIndex { elem, i ->
   if (elem.trim()!=";" && elem.trim().size()>0) {
      println "\n"+(i+1)+". Executing :"+elem

      try {
{'fraction_non_alphanumeric': 0.18855368234250222, 'fraction_numerical': 0.013309671694764862, 'mean_word_length': 4.5816831683168315, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3433451', 'n_tokens_mistral': 806, 'n_tokens_neox': 787, 'n_words': 196}