pyHeimdall
pyHeimdall is an implementation of Heimdall for the Python programming language.
See also
There is another implementation of HEIMDALL for the XQuery programming language:: xHeimdall.
Install
This software is available as a PyPI package named
pyheimdall.You can install it using the pip package manager:
pip install pyheimdall
Quickstart
To use Heimdall’s python modules, you must first import them.
The main module is name heimdall.
import heimdall
To retrieve the contents of a database in format format from location url, just use the heimdall.getDatabase() function:
tree = heimdall.getDatabase(format=format, url=url)
To export a database contents tree to the format format at location url, just use the function heimdall.createDatabase():
heimdall.createDatabase(tree, format=format, url=url)
For example, the following program imports a XML database, then exports it as a SQL dump:
import heimdall
MENAGERIE_XML = 'https://gitlab.huma-num.fr/datasphere/heimdall/python/-/raw/main/tests/examples/menagerie/hera.xml'
tree = heimdall.getDatabase(format='hera:xml', url=MENAGERIE_XML)
heimdall.createDatabase(tree, format='sql:mariadb', url='menagerie.sql')
Wanna learn more?
To discover pyHeimdall features, you can read the reference manual.
Main modules heimdall and heimdall.util are of particular interest.