Idea: import CSV to memory, run SQL, export in a single command
See original GitHub issueI quite often load a CSV file into a SQLite DB, then do stuff with it (like export results back out again as a new CSV) without any intention of keeping the CSV file around afterwards.
What if sqlite-utils
could do this for me? Something like this:
sqlite-utils --csv blah.csv --csv baz.csv "select * from blah join baz ..."
Issue Analytics
- State:
- Created 2 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
Import | IntelliJ IDEA Documentation - JetBrains
In the Database tool window (View | Tool Windows | Database), right-click a schema or a table and select Import/Export | Import Data...
Read more >How to Import and Export CSV Files Using PHP and MySQL
Importing and Exporting data from MySQL and CSV is really easy with PHP. Learn how to carry out this exchange in this excellent...
Read more >Import data in MySQL from a CSV file using LOAD DATA INFILE
You can use the LOAD DATA INFILE command to import a CSV file into a table. Check the link MySQL - LOAD DATA...
Read more >Importing a CSV into SQL Server Shouldn't Be This Hard
A frustrating time importing CSV files leads Steve to test the ... thinking this would be just a few minutes to load and...
Read more >Fast CSV Import in PowerShell to SQL Server - SQLTeam.com
I recently had to write some simple scripts for a proof of concept. These scripts use PowerShell to import and export CSV files...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution:
sqlite-utils memory -
attempts to detect the input based on if it starts with a{
or[
(likely JSON) or if it doesn’t use thecsv.Sniffer()
mechanism. Or you can usesqlite-utils memory -:csv
to specifically indicate the type of input.Wrote this up on my blog here: https://simonwillison.net/2021/Jun/19/sqlite-utils-memory/ - with a video demo here: https://www.youtube.com/watch?v=OUjd0rkc678