Skip to content

Instantly share code, notes, and snippets.

@chbatey
Created February 18, 2015 15:01
Show Gist options
  • Save chbatey/792f1e2885e70f4d376d to your computer and use it in GitHub Desktop.
Save chbatey/792f1e2885e70f4d376d to your computer and use it in GitHub Desktop.
Migration
val customerEvents = new JdbcRDD(sc, () => { DriverManager.getConnection(mysqlJdbcString)},
"select * from customer_events ce, staff, store where ce.store = store.store_name and ce.staff = staff.name " +
"and ce.id >= ? and ce.id <= ?", startingId, highestId, numberOfPartitions,
(r: ResultSet) => {
(r.getString("customer"),
r.getTimestamp("time"),
UUID.randomUUID(),
r.getString("event_type"),
r.getString("store_name"),
r.getString("location"),
r.getString("store_type"),
r.getString("staff"),
r.getString("job_title")
)
})
customerEvents.saveToCassandra("test", "customer_events",
SomeColumns("customer_id", "time", "id", "event_type", "store_name", "store_type", "store_location", "staff_name", "staff_title"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment