API Reference
Browse the programmatic API for pyzot. This SDK provides safe, read-only database connections and query helpers.
Database Connection
pyzot.db.ZoteroDatabase
Context-manager wrapper around a read-only sqlite3 connection.
Source code in src/pyzot/db.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
Queries: Search
pyzot.queries.search
Search queries — field-level and full-text.
get_item_fulltext(db, item_id_or_key)
Return indexed full-text token content (bag-of-words) with metadata fallback.
Source code in src/pyzot/queries/search.py
146 147 148 149 | |
get_item_fulltext_with_strategy(db, item_id_or_key, *, prefer_network=True, auth=None)
Return full-text plus the source used to retrieve it.
Strategy order:
1) .zotero-ft-cache file of any attached PDF (cheapest, most reliable)
2) direct network access (institution/network-location access)
3) config-based auth credentials
4) item metadata fallback
Source code in src/pyzot/queries/search.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
search_by_author(db, query)
Search items by creator first or last name (case-insensitive, partial match).
Source code in src/pyzot/queries/search.py
116 117 118 119 120 121 122 123 124 125 126 127 128 | |
search_fulltext(db, query)
Search the full-text index (fulltextWords table).
Source code in src/pyzot/queries/search.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
search_items(db, query, fields=None, item_type=None)
Search item field values. If fields is None, search all fields.
Source code in src/pyzot/queries/search.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
Queries: Items
pyzot.queries.items
Item queries — the core denormalised fetch.
get_top_level_items(db, library_id=None)
Items not in any collection (top-level unfiled items).
Source code in src/pyzot/queries/items.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
Queries: Collections
pyzot.queries.collections
Collection queries.
get_collection_tree(db, library_id=None)
Return root-level collections with children nested recursively.
Source code in src/pyzot/queries/collections.py
42 43 44 45 46 47 48 49 50 51 52 | |
Queries: Attachments
pyzot.queries.attachments
Attachment queries and path resolution.
enrich_attachment_paths(attachments, data_dir)
Resolve and check existence of attachment paths in place.
Source code in src/pyzot/queries/attachments.py
62 63 64 65 66 67 68 | |
get_all_pdfs(db, data_dir)
Return all (item, attachment) pairs where the attachment is a PDF.
Source code in src/pyzot/queries/attachments.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
resolve_attachment_path(attachment, data_dir)
Resolve the absolute path of an attachment file.
Source code in src/pyzot/queries/attachments.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |