Integrating the local query in your scripts

Until now we looked at how to run queries from the command line, but you can use use the same query run by the --local option directly in your python code. By doing so you also get access to a lot more information on the datasets returned not only the path. To do so we have first to import some functions from the clef.code sub-module. In particular the search( ) function and connect( ) and Session( ) that we’ll use to open a connection to the database.

from clef.code import *
db = connect()
s = Session()