I want to use Clojure's JDBC interface to update an Hive database. In particular, I want to add partitions. The code would be like the following:
(jdbc/db-do-commands hive-db ["ALTER TABLE foo ADD PARTITION (year=2015, month=10, day=1, hour=1) LOCATION '/bar'"])
However, I'm getting an error:
java.sql.SQLException: enabling autocommit is not supported
at org.apache.hive.jdbc.HiveConnection.setAutoCommit (HiveConnection.java:1071)
clojure.java.jdbc$db_transaction_STAR_.doInvoke (jdbc.clj:605)
clojure.lang.RestFn.invoke (RestFn.java:425)
...
As I'm aware, enabling autocommit in Hive's JDBC driver has several unresolved issues presently. Thus I want to disable autocommit. How is this done in clojure.java.jdbc
?
Perhaps something like the following would be of assistance:
(let [con (db-find-connection db)]
(.setAutoCommit con false))
Best of luck.