Update records in SQLite via SQL instead of re-creating the database/file #11
Conversation
…file This moves the update from the filesystem layer into the SQL layer, thus allowing multiple processes to coordinate. Datasette holds open SQLite connections and was keeping references to the deleted files. Since the Makefile recipe got more complicated, move it to a shell script. Resolves #10.
Since I fixed the Either implementation is totally fine by me but wanted to put both out there. |
# room for an empty table after a successful delete but failed insert. | ||
# -trs, 7 July 2020 | ||
if [[ -e "$database" ]]; then | ||
# sqlite3 appears to exits non-zero on a SQL error only when the SQL |
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.
typo: exit instead of exits
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.
See the tiny typo and a question about confirming that the DELETE worked.
Given that you fixed the |
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.
I prefer the sqlite-utils --truncate
solution. Sounds like they are open to making improvements to how they handle transactions 👍
Closing this in favor of #12 then. Thanks for all your comments and our group programming yesterday! |
This moves the update from the filesystem layer into the SQL layer, thus
allowing multiple processes to coordinate. Datasette holds open SQLite
connections and was keeping references to the deleted files.
Since the Makefile recipe got more complicated, move it to a shell
script.
Resolves #10.