2

I am using Azure stream analytics and my input is Eventhub,EVENT SERIALIZATION FORMAT is CSV and DELIMITER is comma(,).My query is select DeviceId,Temperature from input and my output is sql database. but when my job is running it gives me error like

"After deserialization, 0 rows have been found. If this is not expected, possible reasons could be a missing header or malformed CSV input"

and second error is

Could not deserialize the input event as Csv. Some possible reasons:

1) Malformed events

2) Input source configured with incorrect serialization format..

and i am sending data on Eventhub like This

string messageBody1 = "DeviceID:20," + "Temperature:30";
ClientHelper.SendMessage(messageBody1).Wait();
1
  • "Device:20" is more akin to JSON. Jun 16, 2015 at 17:24

1 Answer 1

5

Your current CSV format is wrong because you need to specify column names on the first line and related values in the following lines as :

DeviceID,Temperature
20,30

Paolo

3
  • Hi Paolo ,i am not understand that how we can send data on event hub in CSV format ,bcoz if i create one string with comma then how can i attach header with that string .like this is my code:- string data = "Cleo,Smith"; EventData eventData = new EventData(Encoding.UTF8.GetBytes(data)); eventHubClient.Send(eventData); in this code how can i add header of CSV. Thanks in advance. Jun 29, 2015 at 13:08
  • 1
    Hi, you need to prepend the string with the column names in the following way : string data = "Name;Surname\nCleo;Smith" and then send it. You have to use the carriage return as line separator. You need to add columns name for every record you send. Paolo. Of course it works even if you use complete "\r\n" (carriage return and line feed) as lines separator. You have always to send header with columns name because it's what you do in JSON format : { "Name" : "Cloe", "Surname" : "Smith" } so it's the same for CSV format.
    – ppatierno
    Jun 29, 2015 at 15:53
  • Is it possible to send multiple lines as values too? e.g. string message = "Name;Surname\nCleo;Smith\nJon;Snow\nLeo;Messi\nPepe;Fuentes"?
    – maguri
    Nov 17, 2020 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.