尝试通过数据块流数据帧将数据写入SQl DW。进程正在尝试删除BLOB存储中的temp文件夹并抛出以下内容。在文档中,我看到该过程不会自动清除tempdir。是真的吗如果为true,那么为什么会出现此错误?在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 19/12/20 21:27:32错误AzureNativeFileSystemStore:尝试删除密钥tempDirs / 2019-12-20 / 21-27-29-347 / adca2ed6-a705-4274-8c24-0f0e3d7c64a7 / batch0
时失败答案 0 :(得分:0)
开始之前,请确保“ 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”。
希望这会有所帮助。如果您还有其他疑问,请告诉我们。
请在有助于您的帖子上单击“标记为答案”,然后点击“赞”,这可能会对其他社区成员有所帮助。