title: How to read and write multiple tables in parallel in Spark?
body: <p>In my Spark application, I am trying to read multiple tables from RDBMS, doing some data processing, then write multiple tables to another RDBMS as follows (in Scala):</p>
  
  <pre><code>val reading1 = sqlContext.load("jdbc", Map("url" -&gt; myurl1, "dbtable" -&gt; mytable1))
  val reading2 = sqlContext.load("jdbc", Map("url" -&gt; myurl1, "dbtable" -&gt; mytable2))
  val reading3 = sqlContext.load("jdbc", Map("url" -&gt; myurl1, "dbtable" -&gt; mytable3))
  
  // data processing
  // ..............
  
  myDF1.write.mode("append").jdbc(myurl2, outtable1, new java.util.Properties)
  myDF2.write.mode("append").jdbc(myurl2, outtable2, new java.util.Properties)
  myDF3.write.mode("append").jdbc(myurl2, outtable3, new java.util.Properties)
  </code></pre>
  
  <p>I understand that reading from one table can be paralleled using partitions. However, the read operations of reading1, reading2, reading3 seem sequential, so do the write operations of myDF1, myDF2, myDF3. </p>
  
  <p>How can I read from the multiple tables (mytable1, mytable2, mytable3) in parallel? and also write to multiple tables in parallel (I think same logic)?</p>