Python Forum
Fatally screwed my Data Base up-maybe?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fatally screwed my Data Base up-maybe?
#1
While in DB Browser I think by " save project" vs just "write changes" and close, i have created a situation to where my application can not find the tables. The old .db file is still in the same directory but empty of any tables. There is a new file there now with .db.sqbpro extension that has all my tables in it.
I am using DB Browser for SQLite.
Is there any other way to copy/paste my tables from .db.sqbpro back to .db? I really hate to rebuild them from scratch.
In the Browser looks like my options are "copy create statement" and "export as CSV file" when a table is highlighted. I could not figure out how to get them to work.

Thanks for any suggestions as i know this is off Python subject matter.
Reply
#2

  1. install sqlite3 see: https://www.sqlitetutorial.net/download-install-sqlite/
  2. cd to your database directory
  3. run: sqlite3
  4. type .schema
    you should see all of your tables listed with indexes, etc
  5. type .quit
  6. You can see contents of a table with select * from tablename;
If you don't see any tables, then they are kaput!
Reply
#3
check if this helps https://youtu.be/ssk2RlzuLJA
I think the sqbpro is just linked to your original db file. I doubt it lacks the tables as you claim. I created a sqbpro file for one of my db files and the original file is not affected in any way.
Eventually open the sqbpro file and try to save new db file.

EDIT. the sqbpro file is simple XML file. When you open it, you just open the original db file from the project. There is something else going on here - maybe a second file with same name or something. Probably running the code you created an empty db file with same name at different location.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
Thanks, the suggestion about the second file got me looking. Found a .db file one level up with the same name that had all my tables in it. I deleted the .db file that did not have any tables and moved the one that did back down into the correct directory.
Problem resolved.
How I convoluted that all up in the first place is a mystery.
Slowing down and paying attention is not overrated.
Reply
#5
And perhaps a new backup, just in case.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020