title: Need to convert Spark to Python to copy DF to Azure SQL Server
body: <p>I have the following Scala code which works fine in a Spark environment, but we just switched over to Python last week.  I need to convert the code to run in a Python setup.  How can I do that?</p>
  
  <pre><code>import com.microsoft.azure.sqldb.spark.bulkcopy.BulkCopyMetadata
  import com.microsoft.azure.sqldb.spark.config.Config
  import com.microsoft.azure.sqldb.spark.connect._
  
  val bulkCopyConfig = Config(Map(
    "url"               -&gt; "mysqlserver.database.windows.net",
    "databaseName"      -&gt; "MyDatabase",
    "user"              -&gt; "username",
    "password"          -&gt; "*********",
    "databaseName"      -&gt; "MyDatabase",
    "dbTable"           -&gt; "dbo.Clients",
    "bulkCopyBatchSize" -&gt; "2500",
    "bulkCopyTableLock" -&gt; "true",
    "bulkCopyTimeout"   -&gt; "600"
  ))
  
  df.bulkCopyToSqlDB(bulkCopyConfig)
  </code></pre>
  
  <p>Code comes from here.</p>
  
  <p><a href="https://github.com/Azure/azure-sqldb-spark/blob/master/README.md" rel="nofollow noreferrer">https://github.com/Azure/azure-sqldb-spark/blob/master/README.md</a></p>
  
  <p>It seems like the code should be essentially the same, but I'm sure some of the formatting will be different.  </p>
  
  <p>I am also looking at the site below, but I'm not seeing anything super-useful.</p>
  
  <p><a href="http://www.nerdsgene.com/Article/BulkCopyToSQLDB" rel="nofollow noreferrer">http://www.nerdsgene.com/Article/BulkCopyToSQLDB</a></p>
  
  <p>Any thought?  Thanks to all!</p>