Tag Archives: Get Field Value From Db

CDS Invenio: query database to know a tag value from a record

Which is the quickest way to know the tag’s value of a record using CDS Invenio functions? Imagine you want to know the value for the 8564_u tag of record which sysno=4403

Easy! First, run python. Then:

>>> from invenio.dbquery import run_sql
>>> from invenio.websubmit_functions.Create_Modify_Interface_TAZ import Create_Modify_Interface_getfieldval_fromDBrec
>>> value =  Create_Modify_Interface_getfieldval_fromDBrec('8564_u',4403)
>>> print value
http://aneto.unizar.es/TAZ/CPS/2010/4403/TAZ-2010-077.pdf

There is only a small snag… the database is not always updated, so this information is not absolutely consistent. If the record has been modified recently the value might not be up to date.