Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. //read from source DBs
  2.         val tmo = sqlContext.read
  3.           .format("jdbc")
  4.           .option("url", "jdbc:mysql://<HOST>:3306/<database>")
  5.           .option("user", "")
  6.           .option("password", "")
  7.           .option("dbtable", "select * from athena.tmo")
  8.           .load().toDF()
  9.         val ios = sqlContext.read
  10.           .format("jdbc")
  11.           .option("url", "jdbc:mysql://<HOST>:3306/<database>")
  12.           .option("user", "")
  13.           .option("password", "")
  14.           .option("dbtable", "select * from athena.ios")
  15.           .load().toDF()
  16.  
  17.         //update new DBs
  18.         AthenaDB.update("PSAurora.TMO_scoring_history_staging", tmo)
  19.         AthenaDB.update("PSAurora.IOS_scoring_history_staging", ios)
  20.  
  21.         //rename staging tables
  22.         AthenaDB.renameTable("PSAurora.TMO_scoring_history_staging", "PSAurora.TMO_scoring_history_final")
  23.         AthenaDB.renameTable("PSAurora.IOS_scoring_history_staging", "PSAurora.IOS_scoring_history_final")
  24.  
  25.         AthenaQueue.notifySQS(???)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement