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;
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 )