Skip to main content

A Python database interface for eXist-db

Project description

https://i.ibb.co/JsZqM7z/snakesist-logo.png

snakesist

https://badge.fury.io/py/snakesist.svg Documentation Status https://github.com/delb-xml/snakesist/actions/workflows/tests.yml/badge.svg

snakesist is a Python database interface for eXist-db. It supports basic CRUD operations and uses delb for representing the yielded resources.

pip install snakesist

snakesist allows you to access individual documents from the database using a delb.Document object, either by simply passing a URL

>>> from delb import Document

>>> manifest = Document("existdb://admin:@localhost:8080/exist/db/manifestos/dada_manifest.xml")
>>> [header.full_text for header in manifest.xpath("//head")]
["Hugo Ball", "Das erste dadaistische Manifest"]

or by passing a relative path to the document along with a database client which you can subsequently reuse

>>> from snakesist import ExistClient

>>> my_local_db = ExistClient(host="localhost", port=8080, user="admin", password="", root_collection="/db/manifests")
>>> dada_manifest = Document("dada_manifest.xml", existdb_client=my_local_db)
>>> [header.full_text for header in dada_manifest.xpath("//head")]
["Hugo Ball", "Das erste dadaistische Manifest"]
>>> communist_manifest = Document("communist_manifest.xml", existdb_client=my_local_db)
>>> communist_manifest.xpath("//head").first.full_text
"Manifest der Kommunistischen Partei"

and not only for accessing individual documents, but also for querying data across multiple documents

>>> all_headers = my_local_db.xpath("//*:head")
>>> [header.node.full_text for header in all_headers]
["Hugo Ball", "Das erste dadaistische Manifest", "Manifest der Kommunistischen Partei", "I. Bourgeois und Proletarier.", "II. Proletarier und Kommunisten", "III. Sozialistische und kommunistische Literatur", "IV. Stellung der Kommunisten zu den verschiedenen oppositionellen Parteien"]

You can of course also modify and store documents back into the database or create new ones and store them.

Your eXist instance

snakesist leverages the eXist RESTful API for database queries. This means that allowing database queries using POST requests on 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.

We aim to directly support all most recent releases from each major branch. Yet, there’s no guarantee that releases older than two years will be kept as a target for tests. Pleaser refer to the values of jobs/tests/matrix/exist-version in the CI’s configuration file for what’s currently considered.

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.3.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

snakesist-0.3.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file snakesist-0.3.0.tar.gz.

File metadata

  • Download URL: snakesist-0.3.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.10.141-1-MANJARO

File hashes

Hashes for snakesist-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a0ace94522063084743553823869692f078397b92b38e99675c2203a6ce92b12
MD5 caf530db21aa2ce2148a4dac13904fad
BLAKE2b-256 a28e37bbcc71ed99ed1c800d46cda9f30adcf9272b9ed1bb350f82fa9b76e056

See more details on using hashes here.

File details

Details for the file snakesist-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: snakesist-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.10.141-1-MANJARO

File hashes

Hashes for snakesist-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4774f15b1d594dcc5d417de21c6c12da1d7a3da2bcb8a0fcf4c96e785057992e
MD5 2e6af51d4cfbb69be9a3fdc074e66147
BLAKE2b-256 08dde4846e6840d3194bc2505d219c3470a4d45c0992e811d0a14b52e861c1aa

See more details on using hashes here.

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