Hello,
I have an compressed json which i want to send to eventhub using pyspark notebook. I installed azure-eventhub library on the pyspark pool. I am using the following code.
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub import EventData
eventHubConnectionString = <<connectionstring>>
async def sendToEventHub(jsonString):
compressedData = gzip.compress(jsonString.encode('utf-8'))
encodedData = b64encode(compressedData)
producer = EventHubProducerClient.from_connection_string(eventHubConnectionString)
async with producer:
eventDataBatch = await producer.create_batch()
eventDataBatch.add(EventData(encodedData))
#eventDataBatch.add(EventData(jsonString))
However it fails with this error message
ModuleNotFoundError: No module named 'EventHubProducerClient'
PS - This code works in azure functions.
Do i need to use a different library or anything else to fix this.
Thanks in advance.