Skip to content

Latest commit

 

History

History
139 lines (89 loc) · 4.03 KB

existdb.rst

File metadata and controls

139 lines (89 loc) · 4.03 KB

existdb -- Store and retrieve data in an eXist database

eulexistdb

Direct database access

eulexistdb.db

ExistDB(server_url[, resultType[, encoding[, verbose]]])

getDocument(name)

createCollection(collection_name[, overwrite])

removeCollection(collection_name)

hasCollection(collection_name)

load(xml, path[, overwrite])

query(xquery[, start[, how_many]])

executeQuery(xquery)

querySummary(result_id)

getHits(result_id)

retrieve(result_id, position)

releaseQueryResult(result_id)

QueryResult

ExistDBException

Object-based searching

eulexistdb.query

QuerySet

XmlQuery

Django tie-ins for eulexistdb

eulexistdb.manager

eulexistdb.models

XmlModel

Two use cases are particularly common. First, a developer may wish to use an XmlModel just like an ~eulxml.xmlmap.XmlObject, but with the added semantics of being eXist-backed:

class StoredWidget(XmlModel):
    name = StringField("name")
    quantity = IntegerField("quantity")
    top_customers = StringListField("(order[@status='active']/customer)[position()<5]/name")
    objects = Manager("//widget")

Second, if an ~eulxml.xml.XmlObject is defined elsewhere, an application developer might simply expose ~eulexistdb.db.ExistDB backed objects:

class StoredThingie(XmlModel, Thingie):
    objects = Manager("/thingie")

Of course, some applications ask for mixing these two cases, extending an existing ~eulxml.xml.XmlObject while adding application-specific fields:

class CustomThingie(XmlModel, Thingie):
    best_foobar = StringField("qux/fnord[@application='myapp']/name")
    custom_detail = IntegerField("detail/@level")
    objects = Manager("/thingie")

In addition to the fields inherited from ~eulxml.xmlmap.XmlObject, XmlModel objects have one extra field:

_managers

A dictionary mapping manager names to ~eulexistdb.manager.Manager objects. This dictionary includes all of the managers defined on the model itself, though it does not currently include managers inherited from the model's parents.

Custom Template Tags

eulexistdb.templatetags.existdb

~eulexistdb Management commands

The following management command will be available when you include eulexistdb in your django INSTALLED_APPS and rely on the existdb settings described above.

For more details on these commands, use manage.py <command> help

  • existdb - update, remove, and show information about the index configuration for a collection index; reindex the configured collection based on that index configuration

~eulexistdb.testutil Unit Test utilities

eulexistdb.testutil

~eulexistdb.debug_panel Debug Toolbar Panel

eulexistdb.debug_panel