Pyspark 从Datatricks批量写入Cosmos DB
有人能告诉我asterics**在从Databrick向Cosmos DB写入数据时实现了什么吗Pyspark 从Datatricks批量写入Cosmos DB,pyspark,azure-cosmosdb,azure-databricks,Pyspark,Azure Cosmosdb,Azure Databricks,有人能告诉我asterics**在从Databrick向Cosmos DB写入数据时实现了什么吗 # Write configuration writeConfig = { "Endpoint": "https://doctorwho.documents.azure.com:443/", "Masterkey": "YOUR-KEY-HERE", "Database": "DepartureDelays", "Collection": "flights_froms
# Write configuration
writeConfig = {
"Endpoint": "https://doctorwho.documents.azure.com:443/",
"Masterkey": "YOUR-KEY-HERE",
"Database": "DepartureDelays",
"Collection": "flights_fromsea",
"Upsert": "true"
}
# Write to Cosmos DB from the flights DataFrame
flights.write.format("com.microsoft.azure.cosmosdb.spark").options(
**writeConfig).save()
谢谢在您的案例中,这只是允许您使用列表、元组或字典直接传递多个参数 所以,你不是说:
flights.write.format("com.microsoft.azure.cosmosdb.spark")\
.option("Endpoint", "https://doctorwho.documents.azure.com:443/")\
.option("Upsert", "true")\
.option("Masterkey", "YOUR-KEY-HERE")\
...etc
您只需将所有参数保存在字典中,然后按如下方式传递
flights.write.format("com.microsoft.azure.cosmosdb.spark").options(
**yourdict).save()
这只是允许您在您的案例中使用列表、元组或字典直接传递多个参数 所以,你不是说:
flights.write.format("com.microsoft.azure.cosmosdb.spark")\
.option("Endpoint", "https://doctorwho.documents.azure.com:443/")\
.option("Upsert", "true")\
.option("Masterkey", "YOUR-KEY-HERE")\
...etc
您只需将所有参数保存在字典中,然后按如下方式传递
flights.write.format("com.microsoft.azure.cosmosdb.spark").options(
**yourdict).save()
这回答了你的问题吗?嗨,blackbishop,在这种情况下它没有帮助这回答了你的问题吗?嗨,blackbishop,在这种情况下没有帮助我对你的答案有点困惑。你是说选项(**yourdict)等同于
flights.write.format(“com.microsoft.azure.cosmosdb.spark”)\.option(“端点”:https://doctorwho.documents.azure.com:443/选项(“向上插入”:“真”)\。选项(“主钥匙”:“您的钥匙在这里”)\…等等
@Carltonp,是的,在databricks中,您可以使用.option(key,value).option(key,value).option(key,value).option(key,value)…等将选项作为键/值逐个传递,或者将参数放入字典中,然后使用.options(**yourdict)传递它们。这还让人困惑吗?太好了。非常感谢。我对你的回答有点困惑。你是说选项(**yourdict)等同于flights.write.format(“com.microsoft.azure.cosmosdb.spark”)\.option(“端点”:https://doctorwho.documents.azure.com:443/选项(“向上插入”:“真”)\。选项(“主钥匙”:“您的钥匙在这里”)\…等等
@Carltonp,是的,在databricks中,您可以使用.option(key,value).option(key,value).option(key,value).option(key,value)…等将选项作为键/值逐个传递,或者将参数放入字典中,然后使用.options(**yourdict)传递它们。这还让人困惑吗?太好了。非常感谢你