[英]I can't create-load data from spark dataframe in databricks to Azure Synapse (DWH)
I am new to this field and I am currently playing with Azure & Databricks.我是这个领域的新手,目前正在使用 Azure 和 Databricks。 I ingested a Json file from blob to databricks, did some transformations and wish now to load it to a virgin DWH (Synapse) in Azure.
我将 Json 文件从 blob 摄取到数据块,进行了一些转换,现在希望将其加载到 Azure 中的原始 DWH(突触)。
The code execution shows an error at : .mode("overwrite") and gives the following error: com.databricks.spark.sqldw.SqlDWSideException: Azure Synapse Analytics failed to execute the JDBC query produced by the connector.代码执行在以下位置显示错误:.mode("overwrite") 并给出以下错误:com.databricks.spark.sqldw.SqlDWSideException:Azure Synapse Analytics 无法执行连接器生成的 JDBC 查询。
The cell contains the following code :该单元格包含以下代码:
dwTable= "mytable001"
dwDatabase = "*****"
dwServer = "****.database.windows.net"
dwUser = "****"
dwPass = "****"
dwJdbcPort = "1433"
dwJdbcExtraOptions = "encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
sqlDwUrl = "jdbc:sqlserver://" + dwServer + ".database.windows.net:" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass + ";$dwJdbcExtraOptions"
sqlDwUrlSmall = "jdbc:sqlserver://" + dwServer + ".database.windows.net:" + dwJdbcPort + ";database=" + dwDatabase + ";user=" + dwUser+";password=" + dwPass
tempDir = "wasbs://****@*****.blob.core.windows.net/tempDirs"
acntInfo = "fs.azure.account.key.databrickstrainingst.blob.core.windows.net"
sc._jsc.hadoopConfiguration().set(
acntInfo,
"key****")
spark.conf.set("spark.sql.parquet.writeLegacyFormat","true")
renamedColumnsDF.write \
.format("com.databricks.spark.sqldw") \
.option("url", sqlDwUrlSmall) \
.option("dbtable", dwTable) \
.option( "forward_spark_azure_storage_credentials","true") \
.option("tempdir", tempDir) \
.mode("overwrite") \
.save()
If the encrypt property is set to true
and the trustServerCertificate property is set to false
and if the server name in the connection string doesn't match the server name in the TLS certificate, the following error will occur.如果
encrypt property is set to true
并且trustServerCertificate property is set to false
并且连接字符串中的服务器名称与 TLS 证书中的服务器名称不匹配,则会出现以下错误。 As of version 7.2, the driver supports wildcard pattern matching in the left-most label of the server name in the TLS certificate.从 7.2 版开始,驱动程序支持 TLS 证书中服务器名称最左侧标签中的通配符模式匹配。
("url", "jdbc:sqlserver://cheprasynapse.sql.azuresynapse.net:1433;database=chepra;user={Your_username};password={Your_Password};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.sql.azuresynapse.net;loginTimeout=30;")
When the encrypt property is set to true
and the trustServerCertificate property is set to true,
the Microsoft JDBC Driver for SQL Server won't validate the SQL Server TLS certificate.当
encrypt property is set to true
并且trustServerCertificate property is set to true,
Microsoft JDBC Driver for SQL Server 将不会验证 SQL Server TLS 证书。 This is usually required for allowing connections in test environments, such as where the SQL Server instance has only a self signed certificate.这通常是在测试环境中允许连接所必需的,例如在 SQL Server 实例只有一个自签名证书的情况下。
("url", "jdbc:sqlserver://cheprasynapse.sql.azuresynapse.net:1433;database=chepra;user={Your_username};password={Your_Password};encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.sql.azuresynapse.net;loginTimeout=30;")
For more details, refer Connecting with encryption .有关更多详细信息,请参阅使用加密连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.