A Python Client API for BaseX
BaseX is a light-weight, high-performance and scalable XML Database engine and XPath/XQuery 3.1 Processor, which includes full support for the W3C Update and Full Text extensions. An interactive and user-friendly GUI frontend gives you great insight into your XML documents.
The Python Client provides access to the BaseX features from within python. This enables records to be read and written from/to BaseX. Full support for FLOWR is provided as well as DB admin features.
Creating a new database
# -*- coding: utf-8 -*-
# This example shows how new databases can be created.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient
# create session
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
try:
# create new database
session.create("database", "<x>Hello World!</x>")
print(session.info())
# run query on database
print("\n" + session.execute("xquery doc('database')"))
# drop database
session.execute("drop db database")
print(session.info())
finally:
# close session
if session:
session.close()
Query Example
# -*- coding: utf-8 -*-
# This example shows how queries can be executed in an iterative manner.
# Iterative evaluation will be slower, as more server requests are performed.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient
# create session
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
try:
# create query instance
input = "for $i in 1 to 10 return <xml>Text { $i }</xml>"
query = session.query(input)
# loop through all results
for typecode, item in query.iter():
print("typecode=%d" % typecode)
print("item=%s" % item)
# close query object
query.close()
finally:
# close session
if session:
session.close()
Add Example
# -*- coding: utf-8 -*-
# This example shows how new databases can be created.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient
# create session
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
try:
# create new database
session.create("database", "<x>Hello World!</x>")
print(session.info())
# run query on database
print("\n" + session.execute("xquery doc('database')"))
# drop database
session.execute("drop db database")
print(session.info())
finally:
# close session
if session:
session.close()
Query Bind Example
# -*- coding: utf-8 -*-
# This example shows how new databases can be created.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient
# create session
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
try:
# create new database
session.create("database", "<x>Hello World!</x>")
print(session.info())
# run query on database
print("\n" + session.execute("xquery doc('database')"))
# drop database
session.execute("drop db database")
print(session.info())
finally:
# close session
if session:
session.close()
Metadata
Release files for BaseXClient 8.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| BaseXClient-8.4.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for BaseXClient-8.4.4-py2.py3-none-any.whl |
Release files / BaseXClient-8.4.4-py2.py3-none-any.whl
| Download URL | BaseXClient-8.4.4-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
34f8d80a682e2b06ccf3e79f7276f337f067c6212e49f000d89d1ffdd82dd732
|
|
BLAKE2b-256 checksum How to use checksums |
7e7e9c0b91e96c1789257c14b76f44a40fae487a2945a37ade0578fe6e6d22fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for BaseXClient 8.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.