title: spark reading data from mysql in parallel
body: <p>Im trying to read data from mysql and write it back to parquet file in s3 with specific partitions as follows:</p>
  
  <pre><code>df=sqlContext.read.format('jdbc')\
     .options(driver='com.mysql.jdbc.Driver',url="""jdbc:mysql://&lt;host&gt;:3306/&lt;&gt;db?user=&lt;usr&gt;&amp;password=&lt;pass&gt;""",
           dbtable='tbl',
           numPartitions=4 )\
     .load()
  
  
  df2=df.withColumn('updated_date',to_date(df.updated_at))
  df2.write.parquet(path='s3n://parquet_location',mode='append',partitionBy=['updated_date'])
  </code></pre>
  
  <p>My problem is that it open only one connection to mysql (instead of 4) and it doesn't write to parquert until it fetches all the data from mysql, because my table in mysql is huge (100M rows) the process failed on OutOfMemory.</p>
  
  <p>Is there a way to configure Spark to open more than one connection to mysql and to write partial data to parquet?</p>