Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database changed during migration #2684

Closed
vijaymarupudi opened this issue Oct 22, 2023 · 7 comments
Closed

Database changed during migration #2684

vijaymarupudi opened this issue Oct 22, 2023 · 7 comments
Labels

Comments

@vijaymarupudi
Copy link

vijaymarupudi commented Oct 22, 2023

Debug log ID

JZGY99E2-cRXxRwuSbZKf

What happened?

I've written some scripts to use the better-bibtex.sqlite file to extract some data. Looks like my better-bibtex updated yesterday, and there seems to be some evidence of database corruption? I get this error on the command line.

$> sqlite3 better-bibtex.sqlite '.schema'
Error: malformed database schema (autoexport_setting_insert) - trigger autoexport_setting_insert cannot reference objects in database betterbibtex

I haven't noticed anything wrong when I open Zotero, but didn't try to change anything in fear of data loss.

When I recover the database, like this

$> sqlite3 better-bibtex.sqlite '.recover' | sqlite3 recovered.sqlite

I can use the recovered.sqlite file just fine using my script.

Repository owner deleted a comment from github-actions bot Oct 22, 2023
@retorquere retorquere changed the title Possible database corruption during migration? Database changed during migration Oct 22, 2023
@retorquere
Copy link
Owner

retorquere commented Oct 22, 2023

The database isn't corrupt, but needs a different way to access from outside Zotero. You need to issue

ATTACH DATABASE '<path to better-bibtex.sqlite>'  AS betterbibtex

after which you can read the table as betterbibtex."better-bibtex".

The auto-exports have moved to their own tables (betterbibtex.autoexport and betterbibtex.autoexport_setting), and the citationkeys wil also soon move to their own table.

@vijaymarupudi
Copy link
Author

I see, I had no idea, thank you for the information, and all your work on Better BibTeX!

@retorquere
Copy link
Owner

Thanks! There's no way you could have known.

@kasuar
Copy link

kasuar commented Oct 25, 2023

Where exactly do I issue the following command:

ATTACH DATABASE '' AS betterbibtex

I'm a "simple" Zotero user, with a stand-alone installation within Windows 11. Because of the issue described by the original poster, zotsite doesn't work anymore.

@retorquere
Copy link
Owner

Somewhere in https://github.com/plandes/zotsite/blob/master/src/python/zensols/zotsite/betterbib.py, but I'd prefer it if @plandes reaches out for the fix. I'll help with the fix but I have no idea what it does or how it does it, so I won't be testing anything.

@retorquere
Copy link
Owner

Archaic? Database schemas are a fairly fundamental feature in databases.

@plandes
Copy link

plandes commented Oct 25, 2023

@retorquere I added that previous comment to the wrong issue (sorry for the confusion). Right, schemas are a fundamental feature, but I'm not very familiar with SQLite, never used the feature, or created :memory: connections.

@github-actions github-actions bot removed the reopened label Nov 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants