代码之家  ›  专栏  ›  技术社区  ›  Vincent Chalmel

无法使用pyspark从数据块中写入cosmos db/documentdb中的数据帧

  •  2
  • Vincent Chalmel  · 技术社区  · 7 年前

    当我试图将一直在处理的数据帧保存到documentdb集合时,我会遇到一个我不理解的错误。

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

    另一方面,我找不到一个完整的文档,最终会向该行提供选项。 df.write.format("com.microsoft.azure.cosmosdb.spark").mode('overwrite').options(**ddbconfig).save()

    数据块上的火花给出的错误是:

    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
    

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

    1 回复  |  直到 7 年前
        1
  •  0
  •   Vincent Chalmel    7 年前

    在进一步调查之后,这是我使用的库版本中的一个bug。

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

    正如在Github上看到的 https://github.com/Azure/azure-cosmosdb-spark/issues/268

    推荐文章