Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created May 5, 2017 15:01
Show Gist options
  • Save peteristhegreat/0bece6f4142d66b400774810f07fa658 to your computer and use it in GitHub Desktop.
Save peteristhegreat/0bece6f4142d66b400774810f07fa658 to your computer and use it in GitHub Desktop.
sqlite3 cannot attach database, caused by sql formatting issues...
sqldiff broken.db some_other.db
# output: sqldiff: cannot attach database "some_other.db"
# Use .dump to "clean" and resave the database
sqlite3 broken.db .dump | sqlite3 fixed.db
# Note that the fixed.db will likely be smaller than the original
sqldiff fixed.db some_other.db
# output: standard output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment