[英]Unable to write to Azure Cosmos DB from Databricks
I'm attempting to follow write to Azure Cosmos DB, but failing with the following error:我正在尝试跟随写入 Azure Cosmos DB,但失败并出现以下错误:
flights.write.format("com.microsoft.azure.cosmosdb.spark").options(writeConfig).save()
Flights.write.format("com.microsoft.azure.cosmosdb.spark").options(writeConfig).save()
AttributeError: 'NoneType' object has no attribute 'write'
AttributeError: 'NoneType' 对象没有属性 'write'
I'm using the following document as a guide:我使用以下文档作为指南:
https://docs.microsoft.com/en-us/azure/cosmos-db/spark-connector https://docs.microsoft.com/en-us/azure/cosmos-db/spark-connector
Can someone let me know where I'm going wrong?有人可以让我知道我哪里出错了吗?
First thing I would like to say if that if you follow the documentation I posted it will 100% work.首先我想说的是,如果您遵循我发布的文档,它将 100% 工作。
The reason why if failed for me was because when I originally created the Azure Cosmos DB Account I created with the "Azure Cosmos DB for MongoDB API".如果对我来说失败的原因是因为当我最初创建 Azure Cosmos DB 帐户时,我是使用“Azure Cosmos DB for MongoDB API”创建的。 I should have created it with the Core (SQL) API and selected Apache Spark Notebook, see image
我应该使用 Core (SQL) API 创建它并选择 Apache Spark Notebook,参见图片
After that I used the documentation to connect using Python and it worked first time.之后,我使用文档使用 Python 进行连接,并且第一次成功了。
I hope this helps我希望这有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.