【问题标题】:Issue while writing data from databricks to Azure DW (synapse)将数据从数据块写入 Azure DW(突触)时出现问题
【发布时间】:2019-12-23 21:09:42
【问题描述】:

试图通过databricks流数据帧将数据写入SQl DW。进程正在尝试删除 BLOB 存储中的临时文件夹并在下面抛出。在文档中,我看到该过程不会自动清理 tempdir。这是真的吗?如果为真,那么为什么会出现此错误?在 python 中使用以下查询

df1.writeStream
.format("com.databricks.spark.sqldw")
.option("url", sqlDwUrlSmall)
.option("tempDir", tempDir)
.option("forwardSparkAzureStorageCredentials", "true")
.option("dbTable", "SampleTable")
.option("checkpointLocation", "/tmp_checkpoint_location1")
.option("numStreamingTempDirsToKeep", -1)
.start()

错误 AzureNativeFileSystemStore:在 Blob 上遇到删除存储异常:https://savupputest1.blob.core.windows.net/container1/tempDirs/2019-12-20/21-27-29-347/adca2ed6-a705-4274-8c24-0f0e3d7c64a7/batch0,异常详细信息:不允许在非空目录上执行此操作。错误代码:DirectoryIsNotEmpty 20 年 19 月 12 日 21:27:32 错误 AzureNativeFileSystemStore:尝试删除密钥 tempDirs/2019-12-20/21-27-29-347/adca2ed6-a705-4274-8c24-0f0e3d7c64a7/batch0 时失败

【问题讨论】:

    标签: azure-databricks azure-sql-data-warehouse


    【解决方案1】:

    开始之前,请确保“tempDir”是一个 wasbs URI。我们建议您为 SQL DW 使用专用的 Blob 存储容器。

    这是结构化流的 python 示例。

    # Set up the Blob storage account access key in the notebook session conf.
    spark.conf.set(
      "fs.azure.account.key.chepra.blob.core.windows.net",
      "gv7nVXXXXXXXXXXXXXXXXXXXXXXXXXldlOiA==")
    
    # Prepare streaming source; this could be Kafka, Kinesis, or a simple rate stream.
    df = spark.readStream \
      .format("rate") \
      .option("rowsPerSecond", "100000") \
      .option("numPartitions", "16") \
      .load()
    
    # Apply some transformations to the data then use
    # Structured Streaming API to continuously write the data to a table in SQL DW.
    
    df.writeStream \
      .format("com.databricks.spark.sqldw") \
      .option("url", "jdbc:sqlserver://chepra.database.windows.net:1433;database=chepradw;user=chepra@chepra;password=XXXXXXXXXXX;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;") \
      .option("tempDir", "wasbs://data-files@chepra.blob.core.windows.net/data-files") \
      .option("forwardSparkAzureStorageCredentials", "true") \
      .option("dbTable", "chepradw") \
      .option("checkpointLocation", "/tmp_checkpoint_location") \
      .start()
    

    笔记本的输出:

    更多详情,请参阅“Azure Databricks – Azure SQL DW”。

    希望这会有所帮助。如果您有任何进一步的疑问,请告诉我们。


    请点击“标记为答案”并在对您有帮助的帖子上点赞,这可能对其他社区成员有益。

    【讨论】:

      猜你喜欢
      • 2022-09-23
      • 2021-08-26
      • 2022-07-07
      • 1970-01-01
      • 2019-11-24
      • 2020-11-11
      • 2018-12-25
      • 1970-01-01
      • 2011-01-21
      相关资源
      最近更新 更多