snakesist¶
snakesist
is an experimental Python database driver for eXist-db.
It currently only supports retrieving, updating and deleting resources.
pip install snakesist
Usage example¶
import delb
from snakesist.exist_client import ExistClient
db = ExistClient(
host='my.existdbinstance.org', # defaults to 'localhost'
port='80', # defaults to 8080
usr='foo_bar', # defaults to 'admin'
pw='f0ob4r' # defaults to ''
)
db.root_collection = '/db/foo/bar'
# the client will only query from this point downwards
names = db.retrieve_resources('//*:persName')
# note the namespace wildcard in the XPath expression
for name in names:
if name.node.full_text() == 'Monty':
suffix = delb.TextNode(' Python')
name.node.append_child(suffix)
name.update_push()
else:
name.delete()
Your eXist instance¶
snakesist
leverages the
eXist RESTful API
for database queries. This means that allowing database queries using the
_query=
parameter of the RESTful API is a requirement. eXist allows this by default,
so if you haven’t configured your instance otherwise, don’t worry about it.
Stability¶
This package doesn’t have a stable release yet and lacks sufficient test coverage. Please use with care. It also has delb as a dependency (for accessing the document nodes), which is a very young project developed as a POC at the moment.
Contributions, suggestions, bug reports and feature requests for snakesist
are more than welcome.