Modifying Zotero SQLite database?
I need to modify the "Extra" field in one of my collections, replacing "this text" with "this other text". This could be done programmatically through an UPDATE SQLite statement. I have been playing with a copy of the Zotero SQLite database, and managed to get a SELECT statement [1]. Nevertheless, the documentation states that "even if Zotero is shut down before accessing the file, modifying the database directly bypasses the data validation and referential integrity checks performed by Zotero".
I understand that programmatically creating and deleting records affects the integrity of the database. Nevertheless, I wonder if this applies when changing the text of the field "itemdatavalues" in the table "fields", or if there is a table that stores information of such modifications.
As I understand it, the documentation suggests that this could be achieved by using one of the clients for the WebAPI (like pyzotero) or the JavaScript API. I wonder if someone could confirm this, as I am not familiar with Python or JavaScript.
Thanks very much!
[1] SQLite SELECT statement:
SELECT itemdata.itemID,fields.fieldName,itemdatavalues.value FROM itemdata
INNER JOIN fields ON itemdata.fieldID = fields.fieldID
INNER JOIN itemdatavalues ON itemdata.valueID = itemdatavalues.valueID
INNER JOIN items ON itemdata.itemID = items.itemID
INNER JOIN groups ON items.libraryID = groups.libraryID
WHERE fields.fieldID = 22 and items.libraryID = 5520748;
I understand that programmatically creating and deleting records affects the integrity of the database. Nevertheless, I wonder if this applies when changing the text of the field "itemdatavalues" in the table "fields", or if there is a table that stores information of such modifications.
As I understand it, the documentation suggests that this could be achieved by using one of the clients for the WebAPI (like pyzotero) or the JavaScript API. I wonder if someone could confirm this, as I am not familiar with Python or JavaScript.
Thanks very much!
[1] SQLite SELECT statement:
SELECT itemdata.itemID,fields.fieldName,itemdatavalues.value FROM itemdata
INNER JOIN fields ON itemdata.fieldID = fields.fieldID
INNER JOIN itemdatavalues ON itemdata.valueID = itemdatavalues.valueID
INNER JOIN items ON itemdata.itemID = items.itemID
INNER JOIN groups ON items.libraryID = groups.libraryID
WHERE fields.fieldID = 22 and items.libraryID = 5520748;
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
Upgrade Storage
The standard approach here would be the Javascript API and I think the manual even has template code that you'd only need to adapt lightly (https://www.zotero.org/support/dev/client_coding/javascript_api )