Skip to content

Instantly share code, notes, and snippets.

@MrJaba MrJaba/db_tap.clj
Created Jul 4, 2012

What would you like to do?
JDBCtap issue
(ns paduka.db_tap
(:use cascalog.api)
(:require [cascalog [vars :as v] [ops :as c] [workflow :as w]]
[clojure.string :as s])
(:import [com.twitter.maple.jdbc JDBCScheme JDBCTap TableDesc]
[cascading.tuple Fields])
(defn mysql-tap []
(let [scheme (JDBCScheme. (Fields. (into-array String ["id" "screen_name" "content"])) (into-array String ["id" "screen_name" "content"]))
table-desc (TableDesc. "tweets")
tap (JDBCTap. "jdbc:mysql://localhost:3306/burn?user=root&password=" "com.mysql.jdbc.Driver" table-desc scheme )]
(def tweet-data
[["mrjaba-1" "mrjaba" "tweet 1"]
["mrjaba-2" "mrjaba" "tweet 2"]])
(defn -main []
(let [mysql (mysql-tap)]
(?<- (mysql-tap) [?id] (tweet-data ?id _ _))))

This comment has been minimized.

Copy link

Quantisan commented Jul 5, 2012

(defn mysql-tap []
  (let [scheme (JDBCScheme. (Fields. (into-array String ["?id"])) (into-array String ["id"]))
        table-desc (TableDesc. "tweets" (into-array String ["?id"]) (into-array String ["id"]) (into-array String []))
        tap (JDBCTap. "jdbc:mysql://localhost:3306/burn?user=root&password=" "com.mysql.jdbc.Driver" table-desc scheme )]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.