Zotero storage key system
Hi,
I am trying to understand zotero's database schema and was wondering how storage keys are generated - they don't seem to be listed in the database and I need to automatically generate a list of all files associated with each item.
Thanks in advance for any help!
Tom
I am trying to understand zotero's database schema and was wondering how storage keys are generated - they don't seem to be listed in the database and I need to automatically generate a list of all files associated with each item.
Thanks in advance for any help!
Tom
Upgrade Storage
itemstable in the database.https://forums.zotero.org/discussion/comment/453010#Comment_453010
Unless I'm missing something?
I didn't trust you and now I do;)
Thank you!
SELECT
c.collectionID,
i.itemID as 'i.itemID',
i.key,
idv.value as 'title'
FROM collections AS c
JOIN collectionItems as ci ON c.collectioniD=ci.collectionID
JOIN itemAttachments as ia ON ia.parentItemID=ci.itemID
JOIN items as i ON i.itemID=ia.itemID
JOIN itemData as id ON id.itemID=i.itemID
JOIN itemDataValues as idv ON idv.valueID=id.valueID
JOIN fieldsCombined as fc ON id.fieldID=fc.fieldID
WHERE c.collectionID = 215
AND fc.fieldName = 'title'
- I have a file in the storage folder: Zotero/storage/7I4X9NPV
- My item key: J8TQIS4Q
When I look at the database:
Table: ItemAttachments:
- itemID: 112673, parentitem: 130419
Table. Items:
- itemID: 112673, key: 7I4X9NPV, libraryID: 5520790, itemTypeID: 14
- itemID: 130419, key: J8TQIS4Q, libraryID: 5520790,itemTypeID: 34
Table, ItemTypes:
- ItemTypeID: 14, typeName: attachment
- ItemTypeID: 34, typeName: document
Therefore:
- Items (folders and documents) are stored in the table.items.
- The table.ItemAttachments stores the relationship between attachments (itemID) and documents (parentitem).
- The key of items of type attachment in table.items corresponds to storage folders.
Great! Thanks a lot!