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://travis-ci.org/03b8/snakesist.svg?branch=master

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 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.

Please note that snakesist is tested with eXist 4.7.1 and is not compatible yet with version 5. The bug preventing snakesist to be compatible with the newest major eXist version will be fixed with the release of eXist 5.3.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.2.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snakesist-0.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snakesist-0.2.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.6.6-1-MANJARO

File hashes

Hashes for snakesist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a971856389b57ba4259c142cecebb1afc4c70e147241ab317eb67dff2c63f45
MD5 255775aae0a48a2cb54d5570818e6679
BLAKE2b-256 322548e118c36d7ee21a757d4a19a0ab367b71352793d975ce836581adbc0e4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snakesist-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.6.6-1-MANJARO

File hashes

Hashes for snakesist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d483251f018d61df8d4a3a694b4350c4eff6dc5df934c7cc980d768138d4e5bb
MD5 2dec100f689135c77b07daaea83445fa
BLAKE2b-256 d2bd996b391b25cab49e7e50bbda098571213fc5eaed353d38db90b7b0bcc8e8

See more details on using hashes here.

Supported by

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