Manual:Pywikibot/MySQL/uk

Pywikibot включає базову підтримку запитів SQL у базі даних, подібній до MySQL, або репліці.

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: , see wikitech:Help:Toolforge/Database.

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 MySQL-like 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 return two columns, 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  :

But you can also get other information from database using  library: