I want to edit and create pages and make revisions to a local wiki that I want to play around with. For development purposes I would like to interact with the database directly rather than the REST API. I found the documentation for the php module here https://doc.wikimedia.org/mediawiki-core/master/php/md_docs_database.html. How do I import this module?
What you have found there is not a "module" to "import", it is documentation of how MediaWiki itself queries the database. It's also dated 15 years ago, so there's a fair chance it's not even accurate any more.
Other than adding a prefix to names if the installation is configured to use one, the functions described just build whatever SQL you tell them to, so even if you used them, you'd still need to understand which tables to work with. At that point, it will probably be easier to use whatever application or library you're comfortable with to context directly to the database and run direct SQL.
To find out the layout of the database, you can look in the manual here: https://m.mediawiki.org/wiki/Manual:Database_layout
Your other option would be to write your code as a MediaWiki extension. Then you'd have access to the various helper objects and methods used by the MediaWiki code itself, rather than only those exposed by the API.