pip install mwsql
Collecting mwsql
Downloading mwsql-0.1.0-py3-none-any.whl (272 kB)
|████████████████████████████████| 272 kB 11.7 MB/s eta 0:00:01
Requirement already satisfied: wget>=3.2 in /srv/paws/lib/python3.8/site-packages (from mwsql) (3.2)
Installing collected packages: mwsql
Successfully installed mwsql-0.1.0
WARNING: You are using pip version 21.1.2; however, version 21.2.1 is available.
You should consider upgrading via the '/srv/paws/bin/python3 -m pip install --upgrade pip' command.
Note: you may need to restart the kernel to use updated packages.
from mwsql import load, Dump
file = load('simplewiki', 'page')
dump = Dump.from_file(file)
dump
Dump(database=simplewiki, name=page, size=21654225)
dump.primary_key
['page_id']
dump.col_names
['page_id', 'page_namespace', 'page_title', 'page_restrictions', 'page_is_redirect', 'page_is_new', 'page_random', 'page_touched', 'page_links_updated', 'page_latest', 'page_len', 'page_content_model', 'page_lang']
rows =