How are you accessing calibre? Through a plugin? Though an external app that gets and then manipulates the data?
If you're using a plugin you can get the database object from the library_view. Then calibre.library.database.LibraryDatabase can return the id for an index.
|