Earlier quoted context omitted.
Usability suffers, if you can't type the delimiters easily.
I can’t stand it when I’m banging out a CSV by hand and have to manually escape the field and record separators. Happens all the time.
Q: Run SQL Directly on CSV Files
91–100 of 102 posts
Re: Q: Run SQL Directly on CSV Files
#92Earlier quoted context omitted.
They don’t really get used IMO because if you’re storing ASCII or Unicode text, you have to be prepared for those characters to be in your data. And if you’re storing binary data, delimiters don’t really cut it in the first place.
No it's fine. Just base64 encode the binary data. It's common and streams, or you can capture and convert the entire field at once if you need to seek around in the binary data. https://en.wikipedia.org/wiki/Base64
Re: Q: Run SQL Directly on CSV Files
#93Re: Q: Run SQL Directly on CSV Files
#94Earlier quoted context omitted.
They don’t really get used IMO because if you’re storing ASCII or Unicode text, you have to be prepared for those characters to be in your data. And if you’re storing binary data, delimiters don’t really cut it in the first place.
also they cannot be found in keyboards, if you need to write CSV by hand
Re: Q: Run SQL Directly on CSV Files
#95csvkit includes csvsql, which does this. I’ve used it and liked it. https://csvkit.readthedocs.io/en/1.0.3/tutorial/3_power_tool...
Re: Q: Run SQL Directly on CSV Files
#96Earlier quoted context omitted.
also they cannot be found in keyboards, if you need to write CSV by hand
Can't be found, but you can enter them by hand by holding down alt while entering the ASCII code on the numeric keypad. I wonder if they'll survive posting a comment: 28∟ 29↔ 30▲ 31▼ Edit: looks like they do survive. Hmmm... Now I wonder about extended ASCII. └┐│└└╚╦╝
Re: Q: Run SQL Directly on CSV Files
#97Earlier quoted context omitted.
Text::CSV_XS is my goto module for csv just use that and whack it into MySQL postgress would be my advice.
nah sqlite is what you want when you want a step up from CSV.
Re: Q: Run SQL Directly on CSV Files
#98Re: Q: Run SQL Directly on CSV Files
#99Real-world CSV files generally contain some or all of the following horrors: - some strings enclosed in speechmarks, but some not - empty fields - speechmarks within strings - commas within strings - carriage returns within strings How does Q do up against a CSV file with those traits?
For those reasons I much prefer tab-delimited files. Does anyone know if Q supports that?
harelba (creator of q)
Re: Q: Run SQL Directly on CSV Files
#100Real-world CSV files generally contain some or all of the following horrors: - some strings enclosed in speechmarks, but some not - empty fields - speechmarks within strings - commas within strings - carriage returns within strings How does Q do up against a CSV file with those traits?
More interesting: any kind of delimiter, including chars from utf8 and windows-1252, and you need to detect encoding too. And CSV embedded in CSV, a result of flattening an XML source. And fixed width files, not CSV but where you see CSV you may need to support. And let's not get into date parsing or other typed data, and type inference over sample files.
Any kind of input/output delimiter is supported (-d and -D ), and also multiple encodings (-e ). Also, q performs automatic type inference over the actual data.
Encoding autodetection and fixed width files are not supported though.