# MediaWiki database
This library provides a set of utilities for connecting to and querying a MediaWiki database.
Installation: pip install mwdb
Documentation: https://pythonhosted.org/mwdb
Repositiory: https://github.com/mediawiki-utilities/python-mwdb
License: MIT
The Schema() object is a thin wrapper around a sqlalchemy Engine and Meta adapts to the local database setup. When using Schema() member table ORM, the internal mapping will translate between public replicas views (e.g. revision_userindex, logging_userindex and logging_logindex) transparently. This allows you to write one query that will run as expected on either schema.
At the moment, the execute() method does not make any such conversion, but a helper attribute public_replica that is True when querying a views via public replica and False when querying the production database.
## Example
>>> import mwdb >>> enwiki = mwdb.Schema("mysql+pymysql://enwiki.labsdb/enwiki_p" + ... "?read_default_file=~/replica.my.cnf") >>> enwiki.public_replica True >>> >>> with enwiki.transaction() as session: ... print(session.query(enwiki.revision_userindex) ... .filter_by(rev_user_text="EpochFail") ... .count()) ... 4302 >>> result = enwiki.execute("SELECT COUNT(*) FROM revision_userindex " + ... "WHERE rev_user=:user_id", ... {'user_id': 6396742})>>> >>> print(result.fetchone()) (4302,)
## Authors * Aaron Halfaker – https://github.com/halfak
Metadata
Release files for mwdb 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mwdb-0.1.2.tar.gz | 5.3 kB | Without provenance | Details for mwdb-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mwdb-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for mwdb-0.1.2-py2.py3-none-any.whl |
Total release size: 13.3 kB
Release files / mwdb-0.1.2.tar.gz
| Download URL | mwdb-0.1.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a38082c84b33a88df22385362fed65ae31613dd0d5f7dc57ed76583b7fcdc04b
|
|
BLAKE2b-256 checksum How to use checksums |
b10b8ecf93fedff241ae3200bcfdb1ef8de2f00f23d01c51b728bb450f6e0a43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mwdb-0.1.2-py2.py3-none-any.whl
| Download URL | mwdb-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
14e5d2add1a9e0fe8759e70164147b7df80d02153a11eec3f7181989079d420e
|
|
BLAKE2b-256 checksum How to use checksums |
abef840d6172bec7074147264b6fa1fe9ac3e42c403bb72b61ad7fb8d704426e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mwdb 0.1.2
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.