Import primary/foreign key relationships from MySQL

Is there a way to import a list of the relationships in a MySQL database, and then to load these into dbdiaggram? Seems both time consuming and a bit risky (as it increase risk of human error) by having to specify relationship between every table.

If the functionality doesn’t exist could someone look at Lucidchart, they provide a script which can be run on different flavours of SQL here

Part of our data warehouse is a copy of our application MySQL database pumped into Google BigQuery, and BigQuery doesn’t take the table relationships with it unfortunately.