pgloader Configuration Generator
pgloader migrates MySQL, SQL Server, SQLite and CSV data into PostgreSQL in one command, but everything interesting lives in the .load file: the connection URIs, the CAST rules that decide whether tinyint(1) becomes boolean, the table include and exclude lists, and the batching that decides how long the run takes. This generator builds that file for you from a handful of fields, then gives you the command to run it with logging and a rejected-rows directory, plus the SQL to verify row counts, sequences and constraints once the load finishes. Everything is generated in your browser — no connection details are sent anywhere, and nothing is stored.
Do more than pgloader configuration generator — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Pick the source engine and fill in the source and target connection details, plus the schema you want the tables to land in.
- Choose what pgloader should create (tables and indexes, tables only, or data into existing tables), set the cast rules for booleans and timestamps, and list any tables to include or exclude.
- Copy the generated .load file, run the dry-run command first, then the real command — and finish with the verification SQL to confirm row counts and sequences.
Frequently asked questions
What is a pgloader .load file and why do I need one?
pgloader can run a simple migration straight from the command line — pgloader mysql://user@host/db postgresql://user@host/db — but that form gives you no control over type mapping, table filtering or batching. A .load file is pgloader's command language: it holds the FROM and INTO connection strings, a WITH block of options such as 'create tables', 'downcase identifiers' and 'on error stop', a CAST block that overrides the default type mapping, and optional INCLUDING ONLY / EXCLUDING table filters. Because it is a file, it can be reviewed, put under version control (with the credentials substituted out) and rerun identically for the rehearsal and the real cutover.
How do I stop pgloader turning MySQL tinyint(1) into a smallint?
Add an explicit cast rule: type tinyint when (= 1 precision) to boolean using tinyint-to-boolean drop typemod. The 'when (= 1 precision)' guard means only tinyint(1) columns are affected, so a real tinyint(4) counter still becomes a small integer rather than a boolean. The same pattern handles the other common MySQL surprises — casting datetime to timestamptz with 'using zero-dates-to-null' so 0000-00-00 values become NULL instead of failing the load, and casting enum to text so you get a plain string column rather than a PostgreSQL enum type you have to ALTER TYPE every time a value is added.
How long does a pgloader migration take, and how do I make it faster?
Throughput is bounded by the source's read speed, the network, and how much work PostgreSQL does per row. The biggest wins are: raise workers and concurrency so several tables load in parallel, raise batch rows and batch size so fewer round trips are made, use 'create no indexes' and build indexes afterwards with CREATE INDEX CONCURRENTLY at your own parallelism, and raise maintenance_work_mem on the target for the duration. Always rehearse against a copy first — the rehearsal time is your downtime estimate. Once the data is over, Chat2DB is a quick way to eyeball the migrated schema, compare row counts and fix up the types that came across wrong: https://app.chat2db.ai or download it from https://chat2db.ai/download.
