Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
dev:client_coding:direct_sqlite_database_access [2020/06/14 12:29] bwiernikdev:client_coding:direct_sqlite_database_access [2020/12/24 12:40] – [Direct Access to the Zotero SQLite Database] dstillman
Line 1: Line 1:
 ====== Direct Access to the Zotero SQLite Database ====== ====== Direct Access to the Zotero SQLite Database ======
  
-While it is generally preferable to access Zotero library data via either the [[dev/Server API]] or [[dev/client_coding/JavaScript API]], it is also possible to directly access the SQLite database of the Zotero client using an SQLite client, library, or third-party tool.+While it is generally preferable to access Zotero library data via either the [[dev/Web API]] or [[dev/client_coding/JavaScript API]], it is also possible to directly access the SQLite database of the Zotero client using an SQLite client, library, or third-party tool. All library data is stored in an SQLite database, zotero.sqlite, within the [[:zotero_data|Zotero data directory]].
  
-Zotero uses mozStorage, a database API backed by the SQLite database engine, offering the power of a relational database system within the Mozilla development environment. All system data and item metadata is stored in an SQLite database, zotero.sqlite, within the [[:zotero_data|Zotero data directory]]. +However, **access to the SQLite database should be done only in a read-only manner.** Modifying the database while Zotero is running can easily result in a corrupted database. A caching layer breaks the normal file-locking in SQLite that allows for safe concurrent file access, and 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 and the Zotero web API that are required for Zotero to function properly. Generally, the SQLite database should be viewed as an internal database that has the benefit of being externally readable for people who want to get the data out in other ways. 
- +
-However, **external access to the SQLite database (including direct access via the mozStorage API) should be done only in a read-only manner.** Modifying the database while Zotero is running can easily result in a corrupted database, as mozStorage caching breaks the normal file-locking in SQLite that allows for safe concurrent file access. And even if Firefox is shut down before accessing the file, modifying the database directly bypasses the data validation and referential integrity checks performed by Zotero and the Zotero server that are required for Zotero to function properly. Generally, the SQLite database should be viewed as an internal database that has the benefit of being externally readable for people who want to get the data out in other ways. +
  
 Also be aware that the SQLite database structure can change between Zotero releases. Also be aware that the SQLite database structure can change between Zotero releases.
dev/client_coding/direct_sqlite_database_access.txt · Last modified: 2022/08/14 00:22 by dstillman