html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app https://github.com/simonw/datasette/issues/682#issuecomment-590399600,https://api.github.com/repos/simonw/datasette/issues/682,590399600,MDEyOklzc3VlQ29tbWVudDU5MDM5OTYwMA==,9599,2020-02-24T15:56:10Z,2020-02-24T15:56:23Z,OWNER,"## Implementation plan Method on Database class called `execute_write(sql)` Which calls `.execute_write_fn(fn)` - so you can instead create a function that applies a whole batch of writes and pass that instead if you need to Throws an error of database isn't mutable. Add `._writer_thread` thread property to Database - we start that thread the first time we need it. It blocks on `._writer_queue.get()` We write to that queue with `WriteTask(fn, uuid, reply_queue)` namedtuples - then time-out block awaiting reply for 0.5s Have a `.write_status(uuid)` method that checks if `uuid` has completed This should be enough to get it all working. MVP can skip the .5s timeout entirely But... what about that progress bar supporting stretch goal? For that let's have each write operation that's currently in progress have total and done integer properties. So I guess we can add those to the `WriteTask`. Should we have the ability to see what the currently executing write is? Seems useful. Hopefully I can integrate https://github.com/tqdm/tqdm such that it calculates ETAs without actually trying to print to the console.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",569613563,