[SalesForce] Error when loading csv data into Wave Analytics

CSV file:

"id","name"
"00134535345343542X","Walmart"
"001342323423423232","Amazon"

Metadata JSON file:

{
    "fileFormat": {
    "charsetName": "UTF-8",
    "fieldsEnclosedBy": "\"",
    "fieldsDelimitedBy": ",",
    "numberOfLinesToIgnore": 1
  },
  "objects": [
  {
        "connector": "CIConnector",
        "description": "",
        "fullyQualifiedName": "CSVData",
        "label": "CSV Data",
        "name": "CSVData",
        "fields": [
        {
            "description": "",
            "fullyQualifiedName": "CSVData.Name",
            "label": "Acc Name",
            "name": "Name",
            "isSystemField": false,
            "isUniqueId": false,
            "isMultiValue": false,
            "type": "Text"
        },
        {
            "description": "",
            "fullyQualifiedName": "CSVData.Id",
            "label": "Acc Id",
            "name": "Id",
            "isSystemField": true,
            "isUniqueId": true,
            "type": "Text"
        }
     ]
    }
  ]
}

When uploading the data using InsightsExternalData API, I am receiving the below error:

Error executing node digest: field-count, 2, and header's
column-count, 1, do not match (02K34534523223231M_03C23423423243231A)

I created the CSV data and Metadata JSON following the documentation mentioned in this link

Clearly I have two fields in header and on every line, I have two fields.. Any help on this?

NOTE: I am receiving this error only when loading the data using Cast Iron and It loads fine if I load the above files in UI.

Best Answer

Just wanted to posted on how I solved this. If you upload the above csv file and metadata from UI, it loads fine but it was failing for me when trying to load using Cast Iron.

Here is the documentation on Cast Iron website on how to load csv file into salesforce wave.

Link: http://www.ibm.com/support/knowledgecenter/SSGR73_7.5.1/com.ibm.wci.doc/Salesforce_analytics_connector_LoadData_Activity.html

enter image description here

It says that the dataFile should be base64 encoded but it is not required.

The error in salesforce wave was kind of misleading and led me thinking that there was something wrong with the header but the fact is that it was trying to load the base64 encoded data.

Once I mapped the raw csv data to the field 'DataFile' on the object 'InsightsExternalDataPart' object, it loads fine.

I guess Cast Iron, internally encodes the file so we don't need to do explicitly.

Hope this helps future readers. Thanks!

Related Topic