tripal.db package

Module contents

class tripal.db.DbClient(tripalinstance, **requestArgs)

Bases: tripal.client.Client

Access Tripal/Chado database

get_dbs(db_id=None, name=None)

Get all dbs

Parameters:
  • db_id (str) – A db ID
  • name (str) – filter on db name
Return type:

list of dict

Returns:

Dbs information

get_mviews(name=None)

Get all materialized views

Parameters:name (str) – filter on mview name
Return type:list of dict
Returns:materialized views information
index(mode=u'website', table=None, index_name=None, queues=10, fields=[], links={}, tokenizer=u'standard', token_filters=[], exposed=False, index_url=None, job_name=None, no_wait=False)

Schedule database indexing using elasticsearch

Parameters:
  • mode (str) – Indexing mode: ‘website’ to index the website , ‘nodes’ for the website nodes, ‘entities’ for the website entities (Tripal 3), ‘table’ to index a single table, ‘gene’ to build a Gene search index (Tripal 3 only) (default: website) (‘website’ default to ‘nodes’ for Tripal 2, ‘entities’ for Tripal 3)
  • table (str) – Table to index (only in ‘table’ mode)
  • index_name (str) – Index name (only in ‘table’ mode)
  • queues (int) – Number of indexing task queues (Tripal 2 only)
  • fields (list of str) – Fields to index (only in ‘table’ mode), syntax: <field_name>|<field_type>, field_type should be one of ‘string’ (Tripal2), ‘text’ (Tripal3), ‘keyword’, ‘date’, ‘long’, ‘double’, ‘boolean’, ‘ip’, ‘object’, ‘nested’, ‘geo_point’, ‘geo_shape’, or ‘completion’
  • links (list of str) – List of links to show to users, syntax: <column-where-to-show-the-link>|</your/url/[any-column-name]> (Tripal 2 only)
  • tokenizer (str) – Tokenizer to use (only in ‘table’ mode) (one of ‘standard’, ‘letter’, ‘lowercase’, ‘whitespace’, ‘uax_url_email’, ‘classic’, ‘ngram’, ‘edge_ngram’, ‘keywordx’, ‘pattern’, or ‘path_hierarchy’; default=’standard’)
  • token_filters (list of str) – Token filters (Tripal 3 only) (only in ‘table’ mode) (available filters are ‘standard’, ‘asciifolding’, ‘length’, ‘lowercase’, ‘uppercase’) (Default to [‘standard’, ‘lowercase’])
  • exposed (bool) – “Expose the index (read-only) to other websites
  • index_url (str) – In order for other sites to link back to your results page, you must specify a path where the form for this index can be reached
  • job_name (str) – Name of the job
  • no_wait (bool) – Do not wait for job to complete
Return type:

str

Returns:

Indexing information

populate_mviews(name=None, no_wait=None)

Populate materialized views

Parameters:
  • name (str) – filter on mview name
  • no_wait (bool) – Do not wait for job to complete
Return type:

str

Returns:

Loading information

tune()

Setup default entity index priority for whole website indexing

Return type:dict
Returns:“Status”