-
-
Save BrendanThompson/9269809c2a78e88af19b4e0abe2f8e3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Storage Account | |
val blobStorage = "<blob-storage-account-name>.blob.core.windows.net" | |
val blobContainer = "<blob-container-name>" | |
val blobAccessKey = "<access-key>" | |
val tempDir = "wasbs://" + blobContainer + "@" + blobStorage +"/tempDirs" | |
val acntInfo = "fs.azure.account.key."+ blobStorage | |
sc.hadoopConfiguration.set(acntInfo, blobAccessKey) | |
// Azure Synapse | |
val dwDatabase = "<database-name>" | |
val dwServer = "<database-server-name>" | |
val dwUser = "<user-name>" | |
val dwPass = "<password>" | |
val dwJdbcPort = "1433" | |
val dwJdbcExtraOptions = "encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;" | |
val sqlDwUrl = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass + ";$dwJdbcExtraOptions" | |
val sqlDwUrlSmall = "jdbc:sqlserver://" + dwServer + ":" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass | |
spark.conf.set( | |
"spark.sql.parquet.writeLegacyFormat", | |
"true") | |
renamedColumnsDF.write.format("com.databricks.spark.sqldw") | |
.option("url", sqlDwUrlSmall) | |
.option("dbtable", "SampleTable") | |
.option( "forward_spark_azure_storage_credentials","True") | |
.option("tempdir", tempDir) | |
.mode("overwrite") | |
.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment