无法使用pySpark从Databricks在Cosmos DB / documentDB中写入数据框

时间:2018-12-15 21:29:52

标签: apache-spark pyspark azure-cosmosdb azure-databricks

在尝试保存我一直在处理的文档数据库集合中的数据框时,出现错误,我不明白。

堆栈上的其他类似问题指向为数据库或集合提供的名称不正确或区分大小写,但我检查了这些……还有什么其他解释?分区键?地区?...

另一方面,我找不到完整的文档,该文档最终将为行df.write.format("com.microsoft.azure.cosmosdb.spark").mode('overwrite').options(**ddbconfig).save()

提供选项。

Spark在Databricks上给出的错误是:

com.microsoft.azure.documentdb.DocumentClientException: Message: {'Errors':['Owner resource does not exist']}

StackTrace给出了这些

Py4JJavaError: 
  An error occurred while calling o646.save. :
    com.microsoft.azure.documentdb.DocumentClientException: 
      Message: {"Errors":["Owner resource does not exist"]}

响应中给出了storereadresult

LSN: 623, GlobalCommittedLsn: 623, PartitionKeyRangeId: , IsValid: True, StatusCode: 404, IsGone: False, IsNotFound: True, IsInvalidPartition: False, RequestCharge: 1, ItemLSN: -1, SessionToken: -1#623, ResourceType: Collection, OperationType: Read

edit:与类似链接文章相比,情况有所不同。尝试在新的空集合中写入数据时发生此错误。不读取现有数据。而且我已经在问题中澄清了,我已经探索了在类似帖子中发现的每条路径(主要是集合/数据库名称不匹配)。

1 个答案:

答案 0 :(得分:0)

进一步调查之后,发现我使用的库版本存在错误。

从azure-cosmosdb-spark_2.3.0_2.11-1.2.2-uber.jar切换到azure-cosmosdb-spark_2.3.0_2.11-1.2.7-uber.jar解决

如github所示 https://github.com/Azure/azure-cosmosdb-spark/issues/268

相关问题