Note: I’ve uploaded a basic barebones project based on this series to a GitHub repository for your convenience.
Last time we figured out how to use SWI-Prolog routines in Python. Now we will learn how to connect SWI-Prolog to MySQL and use it to extend Prolog’s built-in database.
Connecting and Disconnecting
The odbc_connect predicate will connect you to your MySQL database. Here I encapsulate it in another predicate for ease of use throughout the rest of my code.
connect :- odbc_connect('mysql.your_database_name', _,