Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
dev:client_coding:direct_sqlite_database_access [2017/12/18 09:02] – Move data model information into this page bwiernik | dev:client_coding:direct_sqlite_database_access [2020/06/14 12:29] – bwiernik | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | ||
- | in the process of updating the documentation for | ||
- | <a href=" | ||
- | may be outdated in the meantime. Thanks for your understanding.</ | ||
- | |||
- | |||
====== 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/ | While it is generally preferable to access Zotero library data via either the [[dev/ | ||
- | 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, | + | 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, |
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. | 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. | ||
Line 17: | Line 11: | ||
====== Zotero Client Data Model ====== | ====== Zotero Client Data Model ====== | ||
- | Each bibliographic record in Zotero has an "item type" (book, journal article, thesis...), a set of fields (author, title, date...), and field values. The selection of fields depends on the item; for instance, a thesis has a " | + | Each bibliographic record in Zotero has an "item type" (book, journal article, thesis, …), a set of fields (author, title, date, …), and field values. The selection of fields depends on the item type; for instance, a thesis has a " |
- | Item types and fields are defined in [[https://www.zotero.org/trac/ | + | Item types and fields, as well as translations into various languages, |
- | In addition to the basic item types and fields, each item can have associated user data as defined in [[https:// | + | In theory, you can change and add item types and fields, but this will break Zotero sync and may make break many parts of Zotero functionality, |
+ | |||
+ | In addition to the basic item types and fields, each item can have associated user data, including: | ||
* a set of notes | * a set of notes | ||
* a set of attachments | * a set of attachments | ||
Line 29: | Line 25: | ||
Attachments (PDFs, snapshots, etc.) are stored inside the [[: | Attachments (PDFs, snapshots, etc.) are stored inside the [[: | ||
- | For a comprehensive | + | For a list of the internal names of fields, their English equivalents, |
- | + | ||
- | ===== Schema Spy ===== | + | |
- | + | ||
- | The comprehensive way of learning about Zotero' | + | |
- | + | ||
- | * for the [[http:// | + | |
- | * for the [[http:// | + |