-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import csv data double quotes escaped by backslash | CSV #10624
Comments
CSV has different escaping rules: double quote is escaped by another double quote, not by backslash. Example:
|
It means that either Apache Spark misses CSV specification or that you did not specified it correctly. |
I was just going through the CSV specification, there are ways to escape it by either double quotes or by backslash. https://en.wikipedia.org/wiki/Comma-separated_values
There are frameworks which allow the escaping characters to be specified which import. is there any way in CH while import i can say use backslash as escape character. ? |
No. CH supports only CSV with "double quote is escaped by another double quote" |
Thanks a lot @den-crane for the clarification. It helps. Closing this ticket now. |
@shivakumarss You can tell Spark to escape quotes using a second quote, instead of the non-standard backslash. That way you'll get correctly exported data, which you can then import to CH as well as other tools. I wrote about this and recommended some options for df.read and df.write. Hope it helps. |
It's also easy to read CSV with backslash escaping in ClickHouse with format_custom_escaping_rule |
I was able to get it working with a query like this:
|
I am trying to import a html snippet which is part of one of the column in csv.
There are double quotes in the html snippet and its is escaped. this csv is created using apache spark.
for illustrating the issue i have just created 2 columns with minimal data.
The the import command is issued following exception is thrown.
Just to add another case here. if i change the sample.csv to
It works fine.
Could you please help me on this issue.
Thanks.
The text was updated successfully, but these errors were encountered: