Skip to content

Instantly share code, notes, and snippets.

@pingles
Created July 20, 2010 13:09
Show Gist options
  • Save pingles/482934 to your computer and use it in GitHub Desktop.
Save pingles/482934 to your computer and use it in GitHub Desktop.
(use '(clojure.contrib sql))
(def db {
:classname "org.apache.hadoop.hive.jdbc.HiveDriver"
:subprotocol "hive"
:subname "//hive-server:10000/default"
:user ""
:password ""})
(try
(with-connection db
(with-query-results rs ["SELECT country, keyword, COUNT(1) as cnt FROM some_clicks WHERE dated = '2010-07-16' GROUP BY country, keyword ORDER BY cnt DESC"]
(dorun (map #(println %) (take 25 rs)))))
(catch java.sql.SQLException e (println (.getMessage e))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment