简体   繁体   English

我无法从 databricks 中的 spark 数据帧创建加载数据到 Azure Synapse (DWH)

[英]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.

相关问题 将数据从 Azure Synapse Serverless SQL 池批量加载到 Azure 存储或 Databricks Spark 的最佳方法 - Best way to bulk load data from Azure Synapse Serverless SQL pools into Azure storage or Databricks Spark Azure 突触 (DWH) 中的关系 - Relationships in Azure synapse (DWH) 从数据块连接到 azure 突触 - Connection from databricks to azure synapse 将数据从数据块写入 Azure 突触专用池时出错 - Error while writing data from databricks to Azure synapse Dedicated Pool 如何在 Databricks 上将 Azure Synapse Dataframe 转换为 JSON? - How to convert Azure Synapse Dataframe into JSON on Databricks? Synapse LINK 从 Azure Cosmos DB 容器加载流式数据帧 - Synapse LINK Load streaming DataFrame from Azure Cosmos DB container 如何在Azure Databricks Spark中从DataFrame获取特定的行和列 - How to get a specific row and column from a DataFrame in Azure Databricks Spark Azure Synapse - 增量数据加载 - Azure Synapse - Incremental Data Load Azure数据从Azure Db同步到Azure DWH - Azure data sync from Azure Db to Azure DWH 在 Azure Synapse Analytics 中看不到 Launch Synapse Studio 或 Create Workspace 选项 - Can't see Launch Synapse Studio or Create Workspace options in Azure Synapse Analytics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM