Skip to main content

A set of utilities for connecting to and querying a MediaWiki database.

Project description

# MediaWiki database

This library provides a set of utilities for connecting to and querying a MediaWiki database.

## Basic example

>>> import mwdb
>>> enwiki = mwdb.Schema("mysql+pymysql://enwiki.labsdb/enwiki_p" +
...                     "?read_default_file=~/replica.my.cnf")
>>>
>>> with enwiki.session() as session:
...     print(session.query(enwiki.user)
...           .filter_by(user_name="EpochFail")
...           .first())
...
(6396742, b'EpochFail', b'', None, None, None, None, None, None, None,
None, None, b'20080208222802', None, 4270, None)
>>> result = enwiki.execute("SELECT * FROM user WHERE user_id=:user_id",
...                         {'user_id': 6396742})
>>>
>>> print(result.fetchone())
(6396742, b'EpochFail', b'', None, None, None, None, None, None, None,
None, None, b'20080208222802', None, 4270, None)

## Author * Aaron Halfaker – https://github.com/halfak

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

mwdb-0.0.1.zip (7.2 kB view hashes)

Uploaded Source

mwdb-0.0.1.tar.gz (3.0 kB view hashes)

Uploaded Source

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