automating hive queries