Project:Sandbox

Pywikibot includes basic support for MySQL queries on SQL-based database or replica.

Pywikibot
To make Pywikibot work with SQL-based database or its replica, make sure you have   library installed. Probably you already installed it when installing Pywikibot. Otherwise run:

Second you should update the   section in your   file: .

From dump
If you want to run your local instance (e.g. a copy loaded from Wikimedia dump), follow the following steps:

For Wikimedia dump first download your chosen sql dump from: https://dumps.wikimedia.org/backup-index.html.

Second install and configure   or other preferred SQL-based database on your local machine. Follow your OS distribution manual (e.g. https://wiki.archlinux.org/index.php/MySQL).

Once ready, start MySQL terminal/command line interface:

and create new database using the database name chosen before:

In case of Wikimedia dump finally you have everything prepared for the final step: importing the downloaded sql table dump to your prepared local database:

or you can declare your own database containing page namespace, page title and some additional rows of your choice:

Terminal/command line
If the desired script supports , you can run your script with  generator. You will be prompted for the query if no query specified. The query should select page namespace and page title pairs from some table, e.g.:

Inside your script
If your script does not support page generators yet, you can import  </> from <tvar|file> </>:

But you can also get other information from database using <tvar|mysql> </> library: