Skip to main content

A Python database interface for eXist-db

Project description

https://badge.fury.io/py/snakesist.svg Documentation Status https://travis-ci.org/03b8/snakesist.svg?branch=master

snakesist is a Python database interface for eXist-db. It supports creating, retrieving, updating and deleting and uses delb for representing the yielded resources.

pip install snakesist

Usage example

from snakesist import ExistClient

db = ExistClient(
    host='my.existdbinstance.org',  # defaults to 'localhost'
    port='80',  # defaults to 8080
    user='foo_bar',  # defaults to 'admin'
    passwordw='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

# append 'Python' to all names which are 'Monty' and delete the rest
for name in names:
    if name.node.full_text == 'Monty':
        name.node.append_child(' Python')
        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 in the used eXist-db backend. eXist allows this by default, so if you haven’t configured your instance otherwise, don’t worry about it.

snakesist is tested with eXist 4.7.1 and is not compatible yet with eXist 5.0.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakesist-0.1.0.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

snakesist-0.1.0-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page