Azure Event Hubs与Python中的Apache Spark集成

时间:2019-01-24 16:43:42

标签: python azure pyspark databricks

我想知道python中是否有like这个东西?

如果是这样,您能为任何网络提供示例吗?

额外:

如果您尝试像普通的python程序一样运行它,则会给您一个错误:

使用以下命令运行它:

spark-submit --packages com.microsoft.azure:azure-eventhubs-spark_2.11:2.3.9 nameoffile.py

1 个答案:

答案 0 :(得分:1)

https://docs.databricks.com/_static/notebooks/structured-streaming-python.html

https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/PySpark/structured-streaming-pyspark.md

# Source with default settings
connectionString = "YOUR.CONNECTION.STRING"
ehConf = {
  'eventhubs.connectionString' : connectionString
}

df = spark \
  .readStream \
  .format("eventhubs") \
  .options(**ehConf) \
  .load()