3
sqlite-schema-diagram
source link: https://gitlab.com/Screwtapello/sqlite-schema-diagram
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Project information
Created on
March 22, 2024
Screwtape
authored
6 hours ago
For this templating to work, we need to make sure sqlite3 doesn't include any output beyond the values we generate. I assumed that "-list" on the command-line was equivalent to ".mode list" interactively, and that all the supported .mode values were mutually exclusive so it would produce predictable output. It turns out that's not the case: if someone has ".mode columns" in their ~/.sqliterc that implicitly sets ".headers on", and ".mode list" (or "-list") does not turn them off again. Instead of wrestling with overriding all the possible settings that might be in ~/.sqliterc let's pass a query string on the command-line, which forces sqlite3 to start up in a non-interactive mode with predictable behaviour. You're supposed to put your query into the string, but I don't want to deal with nested shell and SQL quoting, so I'll leave the query in a file, read it with "-init", and use an empty query. That seems to work nicely. Fixes #1.
8996d7df
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK