Import a large .sql file into your BrewInTH database with your AI

A .sql dump too big to run one statement at a time? Your AI can import the whole file, up to 512 MB or as .sql.gz. How to prepare, back up and check it.
Manee's bakery site now lives on BrewInTH, and the AI that helped write the code has already deployed it. What's missing is the old data: three years of customers, menu items and orders, exported from phpMyAdmin at the old host as shop-backup.sql, 85 MB of it. The SQL box in the console takes one statement at a time, and a database tool on her own computer can't connect to the database at all.
On BrewInTH, a file like this goes in whole, in one go, through the AI connected to your project: up to 512 MB, and it can be compressed to .sql.gz first. This guide explains how that import works, how to prepare the file, what to watch out for when the database already holds data, a message you can paste to your AI, and how to read the result so you know everything arrived.
In short
📦 Your AI can import a whole.sqlfile into the project's PostgreSQL, MySQL or MariaDB database, up to 512 MB, as.sqlor.sql.gz
🧙 The file is fed to the database's own client, the way phpMyAdmin does it, so SET lines, DELIMITER blocks and COPY work
⚠️ The database is not emptied first: back up a database that already has data
🔎 When the job ends, ask your AI for the errors count; anything above 0 means statements were skipped
🤖 The console has no import button; this is done by an AI holding the project's token
Why you can't import from your own computer
Each project's database sits on that project's private network. Your app on BrewInTH can reach it; a computer outside cannot. The connection details on the Databases tab are for apps running on the platform, not for tools on your machine such as DBeaver or MySQL Workbench. The upside is that nobody outside can reach your database directly. The downside is that the way you imported data at your old host has to change.
The SQL box in the Database browser on that tab runs one statement at a time, up to 10,000 characters, finishing within 10 seconds. That's right for fixing a few rows (browse and fix your database from the console). A whole dump goes through the import route instead, sent by your AI.
Three ways in, chosen by size
- One statement: the console's SQL box, or your AI's
database_query. One statement of up to 10,000 characters, for fixing a few rows. database_import: your AI sends the whole file as text through MCP, up to 15 MB. Good for small to mid-sized files.- Send the file: your AI sends the file from your computer to
POST /api/databases/{id}/importas.sqlor.sql.gz, up to 512 MB. The one for large files.
Routes 2 and 3 do the same thing once the file arrives; only the delivery differs. Route 3 is better for large files because your AI can run curl to send the file straight from your computer without reading all of it, so your customers' data doesn't pass through the chat either. A WordPress dump always belongs on one of the whole-file routes: the one-statement route runs with a stricter sql_mode, and some of WordPress's statements fail there.

If this site was deployed through the Upload & go live page, there's one more way: put the .sql file in the ZIP and it's imported for you (upload a ZIP and go live). A site that an AI agent deployed through a link and token can't be picked on that page, though; the page says it was released by an AI agent and the agent should update it. For those sites, the AI route in this guide is the way.
Prepare the file
- Plain
.sqlor.sql.gz. Gzip is unpacked for you; a.ziphas to be unpacked to.sqlfirst. - Up to 512 MB once unpacked. Gzip makes the transfer faster but doesn't raise the limit. For anything bigger, have your AI split it into several files, for example one per table.
- 30 minutes per file. An import that runs longer is stopped, so a file with a lot of data is worth splitting too.
- For PostgreSQL, a plain-text pg_dump, which is pg_dump's default. The
.pgdumpfiles you download from BrewInTH's Backups panel are in the custom format, which this route can't read: to put the data back into the same database, press Restore on that row; to load it into another database, have your AI turn it into a text file with pg_restore first. - Thai text in UTF-8. This route doesn't convert old Thai encodings (tis620 or latin1) the way the Upload & go live page does. If you're not sure, have your AI look at the top of the file first.
- The database name in the file doesn't matter. Lines that create or switch databases, such as CREATE DATABASE and USE, are skipped, so the data always lands in the project's database.
- PostgreSQL, MySQL and MariaDB only. MongoDB and Redis can't be imported this way.
A .sql.gz downloaded from the Backups panel of a MySQL or MariaDB database can be sent this way as it is, which makes it easy to copy data into the same kind of database in another project.
Check your space before you start, too. Data in your databases counts toward your package's storage: Free has 20 MB and Starter 200 MB for the files and databases of all your projects together. If you go over, your sites keep running, but you can't upload files or publish new releases until you use less or upgrade. The numbers are in the Resource distribution panel under Projects (your package's space is counted by real use).

Already have data? Back up first
The database is not emptied before the import. Every statement in the file runs against what's already there, so the outcome depends on how the file was written.
- The file has DROP TABLE: tables with the same names are dropped and rebuilt from the file, and their current data is gone. mysqldump adds these statements by default; phpMyAdmin has an Add DROP TABLE option on its Export page.
- The file has no DROP TABLE: creating a table that already exists fails, and rows whose ids are already taken fail, so old and new data end up mixed.
Before importing into a database that has data, open the Databases tab and press Back up now in the Backups panel, then wait for it to finish. If the result isn't what you wanted, press Restore on that copy. Backups need the Backups add-on at ฿99 a month. Without it, import only into an empty database, and have your AI check which tables exist first (back up and restore your database on BrewInTH).
Hand it to your AI
Your AI needs a project token with the Create DBs, run SQL and retrieve credentials permission. The Create the AI link and token (automatic) button under the project name gives a 24-hour token with every permission; to grant only some, use Custom permissions / lifetime (what your AI can see, permission by permission).
Once your AI is connected to the project, put the file in the folder it's working in and send it this message, with your own file name:
Please import shop-backup.sql from this folder into my project's database on BrewInTH.
- Use the whole-file import route from the BrewInTH guide; don't split it into single statements.
- If the file is larger than 15 MB, compress it to .sql.gz and send the file itself with curl to POST /api/databases/{id}/import as application/octet-stream. Don't read the file's contents into the chat.
- Before sending, tell me how big the file is unpacked, which character set it uses, and which tables the database has now.
- If the database already has data, back it up first and wait until the backup is done. If the backup isn't possible, stop and ask me.
- Follow the job with operation_get until it ends. waiting_configuration means it's still working; don't send the file again.
- When it's done, tell me the errors count, which statements failed, and the row counts of the main tables.
No AI agent on your computer yet? See setting up Claude Code, Codex, Cursor and Windsurf for BrewInTH.
What happens during the import
- The whole file goes to the database's own client: mariadb for MySQL and MariaDB, psql for PostgreSQL. The file's SET lines take effect, DELIMITER blocks for procedures and triggers work, and pg_dump's COPY data works too.
- MySQL and MariaDB import with foreign key checks off, so the order of tables in the file doesn't cause failures.
- A statement that fails is skipped and counted, and the import carries on to the end of the file.
- One file at a time per database, in the order sent, so you can send a schema file before a data file.
- Your site stays up, though the app may see incomplete data while the import runs. On a site people are using, import at a quiet time. A new release published meanwhile waits until the import is done.
- The file isn't kept. It's deleted once imported, and a file no job comes for is deleted within a day.
In the console, the job shows under Overview › Recent activity as Run SQL. While it imports, its status mostly reads Needs configuration. That doesn't mean you have anything to configure; look at the details next to it:
Importing the SQL file: importing nowWaiting for an earlier import into this database: an earlier file for the same database goes firstWaiting for another SQL import to finish: waiting for the machine's import queueWaiting for the database instance before importing the SQL file: the database is restarting, and the import starts on its own afterwards
Read the result and check the data
When the job ends, your AI sees the status succeeded and the numbers in the job's result.
- errors is 0: every statement in the file ran.
- errors is above 0: some statements were skipped. Have your AI read failed, which keeps the first 10 error lines. One statement can carry hundreds of rows, because dumps pack many rows into each INSERT, and one PostgreSQL COPY is a whole table's data.
- The status is failed: the client stopped before the end of the file, for example after 30 minutes or because the platform restarted midway. Part of the data may be in. Have your AI read the error, and talk it through before sending the file again.
Here's what a line in failed looks like when an imported row has an id that's already taken:
ERROR 1062 (23000) at line 5120: Duplicate entry '15' for key 'customers.PRIMARY'
Succeeded in Recent activity means the job ended; it doesn't say how many statements failed. Always ask your AI for the errors count.

An errors count of 0 still doesn't prove you have everything the old system had: the export itself may have been incomplete. Open the Database browser to see the tables (MySQL and MariaDB databases show rough row counts too) and compare them with the old host, or have your AI count the rows of the main tables. For data your business depends on, such as customers or sales, matching counts aren't enough; the Chawinnix team explains how to check business data after a migration, beyond matching counts, from comparing reference codes to sampling Thai names and empty dates.
What may come next
- WordPress: this route imports the data exactly as it is in the file, so the old site address in posts and settings still points at the old host. The Upload & go live page replaces it for you; here, have your AI replace it in a way that respects WordPress's serialized values. Don't search and replace in the .sql file directly: the lengths WordPress stored no longer match, and settings break (moving WordPress to BrewInTH).
- New code with migrations: have your AI run them after the import, for example from the Commands tab (the Commands tab on BrewInTH).
- The app still shows old data: if your app caches, press Restart the app in the project page's ⋯ menu.
FAQ
My file is larger than 512 MB. What now?
Have your AI split it into files of up to 512 MB each once unpacked, for example one schema file and then data files per table, and send them in order. Imports into one database run one file at a time, in the order they were sent.
Can I import the same file again?
Yes, but the database isn't emptied first. If the file has no DROP TABLE, rows are duplicated or fail on taken ids. The safe way is to restore the backup taken before the import, then import the corrected file.
Does my site go down during the import?
No. It keeps running, though tables still being imported may be incomplete, and a new release published meanwhile waits until the import is done.
Does this work with MongoDB?
No. This route is for PostgreSQL, MySQL and MariaDB only. For MongoDB, let your app load the data, or have your AI write an import script and run it in the app with job_run.
Is my file kept on BrewInTH?
No. The import file is deleted once it has been imported, and one no job comes for is deleted within a day. The copy on your own computer holds all your customers' data, so keep it safe or delete it when you no longer need it.
Can I do this without an AI agent?
If no AI agent ever deployed this site, you can put the .sql file in a ZIP on the Upload & go live page, and the console's SQL box handles a few rows. Importing a whole file into a site an AI agent looks after is a job for the AI.
Summary
A .sql file too big to run statement by statement goes in whole through the AI connected to your project: up to 15 MB with database_import, and up to 512 MB when your AI sends the file itself as .sql or .sql.gz. Before sending, check the file type, the size, the Thai encoding and your package's space; back up first if the database has data; and when it's done, ask your AI for the errors count and compare row counts with the old system.
