-
Notifications
You must be signed in to change notification settings - Fork 351
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
Fix bug where csv strings were triple quoted #1970
Conversation
@@ -648,6 +648,31 @@ describe('helpers', () => { | |||
// Then | |||
expect(res).toEqual([['"P1M2DT3.000000004S"']]) | |||
}) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we test the records that come from:
return "hello " "
or
return '"'
or even
return '
"
'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> hello " ,
=> ",
=> "
""
"
Maybe it should become something like those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried these ones and the results end up looking like:
return "hello \" "
:
"""hello \"" """
"hello \"" "
return '"'
:
"'""'"
"\"""
return ' " '
(with new lines):
"'
""
'"
"
\""
"
Seems like they are all valid csv exports but let me check why in the first case the column name got triple quotes once again instead of just one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also tried the below query to see different types as we've talked before.
CREATE (n {string: "string",boolean: true,integer: 1,float: 2.0,point: point({x:1,y:2}),date: date(),time: time(),datetime: datetime(),localtime: localtime(),localdatetime:localdatetime(),duration: duration("P5M1.5D"),numberList: [1,2,3],stringList: ["a"],emptyList: []}) RETURN n, n.string, n.boolean, n.integer, n.float, n.point, n.date, n.time, n.datetime, n.localtime, n.localdatetime, n.duration, n.numberList, n.stringList, n.emptyList
The exported CSV looks as follows:
n,n.string,n.boolean,n.integer,n.float,n.point,n.date,n.time,n.datetime,n.localtime,n.localdatetime,n.duration,n.numberList,n.stringList,n.emptyList
"({localtime: 10:21:41.776000000,date: 2024-06-06,string: string,integer: 1,float: 2.0,point: point({srid:7203, x:1, y:2}),duration: P5M1DT43200S,emptyList: [],datetime: 2024-06-06T10:21:41.776000000Z,boolean: true,stringList: [a],numberList: [1, 2, 3],time: 10:21:41.776000000Z,localdatetime: 2024-06-06T10:21:41.776000000})",string,true,1,2.0,"point({srid:7203, x:1, y:2})",2024-06-06,10:21:41.776000000Z,2024-06-06T10:21:41.776000000Z,10:21:41.776000000,2024-06-06T10:21:41.776000000,P5M1DT43200S,"[1, 2, 3]",[a],[]
which is a valid CSV without triple quotes 💃.
Thinking back on the triple quotes in the column name in the top comment, I believe it is expected as indeed the column name is "hello \" "
rather than just hello \"
. We can try to remove the quotes in that case as well but for that, we may need to add an if check which removes the quotes from the beginning and the end of the result record.
Will be testing the jar file and merge the pr if all is good.
This pull request is to remove triple quotes from the csv export of statements.
Before, exported csv:
After with this pr changes, exported csv:
Please see the following doc for csv quote requirements: https://www.ietf.org/rfc/rfc4180.txt