Yes, in the identify() method it wont work, since that is run in a worker process. Because of your previous questions, I somewhat sloppily assumed you meant the url_from_identifier() method.
You can just directly read for the database, with something like this,
Code:
import apsw
conn = apsw.Connection('/path/to/calibre/metadata.db', apsw.SQLITE_OPEN_READONLY)
apsw is multi-process/thread safe so it should be fine.