Closed ffaristocrat closed 6 years ago
Maybe there should be a warning if the data has problems?
The rest of the upload options (|, double quote, quote all) should be standard though as they cause the least issues uploading into platform.
Could you separate the best-practice CSV creation options into a different PR while we discuss the best approach on this one? Don't forget to update the changelog.
Will do
Closing this per @stephen-hoover's objections.
This is related to this ongoing JIRA
https://civisanalytics.atlassian.net/browse/CIVP-12730
Platform import simply can't handle files that have a
/"
anywhere in the file.If a double quote is escaped with a backslash, the import fails. If a file has fields enclosed by double quotes and any field ends with a
/
, the import fails.This PR does two things to ensure a DataFrame will be succesfully imported via API:
\
as the escapechar and all fields enclosed in double quotes and imports it into platform with the same parameters.There may be a broader goal of preparing any file (including already existing CSVs) in this fashion to ensure successful import to Platform but for now, this only addresses the dataframe to Civis situation.
I've encountered this bug while writing the Classy & MobileCommons integrations and wrote a modified version of dataframe_to_civis to handle the
/"
problems. This PR brings over the changes that have been succesfully importing data from those system.I've included tests for the clean_text function.