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
  • edited February 22, 2024
    Storage subfolders are item keys. They're in the items table in the database.
  • Thanks for the reply. I initially thought the same but it doesn't seem to be the case as the keys don't match the folder names - or at least the majority of keys don't match. This post (search for the word storage) confirms what I discovered:
    https://forums.zotero.org/discussion/comment/453010#Comment_453010

    Unless I'm missing something?
  • edited February 23, 2024
    You're going to have to trust me on this one. The folders are named after the item keys of attachment items.
  • Sorry for the delay - got distracted and picked this up again.

    I didn't trust you and now I do;)
    Thank you!
  • Thought i'd add the SQL query which returns a list of titles and storage keys for all items in a given collection (in this instance the collectionID of 215). What confused me what that the itemID's referred to in the collectionItems table don't identify the correct storage location key - its the parentItemID in the itemAttachments table which creates the relationship:


    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'


Sign In or Register to comment.