4 ms·
These are great! I wrote a quick ruby script that converts one or more CSV files into an SQLITE db file, so you can easily query them. https://github.com/derg
by dergachev 13y ago
These are great!
I wrote a quick ruby script that converts one or more CSV files into an SQLITE db file, so you can easily query them.
https://github.com/dergachev/csv2sqlite https://github.com/dergachev/csv2sqlite
- aw3c2 13y agoNo (real) need for a script, you can import in the sqlite3 commandline. First make the table, then set a .separator, then .import the file. I am not sure how performant it is though, so creating transactions outside might be better in some cases.
- kevnin 13y agoDepends on how often you have to do this... if it saves time, I'm in
- mkiwala 13y agoThe sqlite3 .import command does not handle quoted csv values. "Doe, John", 1234 Pine St, Springfield That would be imported as 4 fields, not 3.
- SQLite 13y agoUsed to be true. But recent versions of SQLite fix this.
- dergachev 13y agocsv2sqlite actually generates the table definitions for you, so I think that's a big improvement when you just downloaded a CSV file with 30 columns in it and need to quickly verify it or extract some data from it. Also supports parsing multiple CSV files at once, so you can easily do joins.