11 Exporting Data
The Research Information Gateway offers two primary methods to export data from Dolt:
SQL Dump: Generate a complete database dump in SQL format for importing into other database systems like MySQL. This approach exports the entire database with schema and data.
CSV Export via DoltHub API: Extract specific tables or query results as CSV files through the DoltHub API. This method is useful for targeted exports or when you need data in a format compatible with spreadsheet applications.
11.1 Exporting Data to a MySQL Database
Open the terminal or command prompt.
Navigate to the Dolt database directory.
Run the following command to create a SQL dump file:
dolt dump -f
This will create a file called
doltdump.sql
that contains all the SQL statements needed to recreate the database structure and data.
11.1.1 Notes
The doltdump.sql is currently ~ 235Mb in size.
11.2 Importing Data into MySQL
Make sure MySQL is installed and running.
Import the dump file into the MySQL database:
mysql -u username -p database_name < doltdump.sql
Replace
username
with the appropriate MySQL username anddatabase_name
with the name of the target MySQL database.When prompted, enter the MySQL password.
Wait for the import process to complete.
11.2.1 Notes
- The generated SQL dump contains standard SQL that’s compatible with MySQL.
- This approach migrates both the schema (tables, views, etc.) and data in one operation.
- You may need to create the target MySQL database first if it doesn’t already exist.