none
Trying to push a dataframe to Azure SQL Server RRS feed

  • Question

  • 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?

    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"               -> "mysqlserver.database.windows.net",
      "databaseName"      -> "MyDatabase",
      "user"              -> "username",
      "password"          -> "*********",
      "databaseName"      -> "MyDatabase",
      "dbTable"           -> "dbo.Clients",
      "bulkCopyBatchSize" -> "2500",
      "bulkCopyTableLock" -> "true",
      "bulkCopyTimeout"   -> "600"
    ))
    
    df.bulkCopyToSqlDB(bulkCopyConfig)
    


    Code comes from here.

    https://github.com/Azure/azure-sqldb-spark/blob/master/README.md

    Any idea how to convert the code to work in a Python environment with a SQL Server endpoint?


    MY BOOK

    Sunday, November 24, 2019 11:40 PM