ConvertCSV

Migrate Data Between Databases with CSV

By Convert CSV Editorial TeamLast updated August 1, 2026

Use CSV as a bridge to migrate data between databases. Plan exports, schema mapping, staging loads, reconciliation, and cutover with minimal downtime.

Why CSV Works as a Migration Bridge

Native dump formats differ between engines. CSV is universal: every database can export it and every database can import it. For many table-level migrations—especially when types are simple and volume is moderate—CSV is the pragmatic bridge while you rebuild schemas on the target.

It is not ideal for every object (procedures, triggers, complex types), but for row data it is hard to beat.

Migration Phases

Treat migration as a project with checkpoints, not a single COPY command.

  • Inventory tables, volumes, PII, and dependencies (FK order).
  • Design target schema and column maps.
  • Dry-run export → transform → stage → reconcile on a copy.
  • Full load + incremental catch-up if downtime must be short.
  • Cutover, verify, and keep a rollback path.

Step-by-Step: Export from the Source

Export table-by-table in dependency order (parents before children).

-- PostgreSQL example
COPY (
  SELECT id, email, created_at
  FROM users
) TO '/tmp/users.csv'
WITH (FORMAT csv, HEADER true, ENCODING 'UTF8');

Consistent snapshots

For related tables, export inside a repeatable-read transaction or from a backup snapshot so foreign keys still line up.

Map and Transform

Schemas rarely match 1:1. Build an explicit mapping sheet: source column → target column → transform rule.

SourceTargetTransform
UserIDuser_idcast to text
CreateDatecreated_atparse MDY → ISO timestamp
IsActiveis_activeY/N → true/false
Amountamount_centsdollars → integer cents
Notesnotestrim; empty → NULL

Where to transform

Small jobs: Online CSV Editor or scripts. Large jobs: SQL on a staging schema or a dedicated ETL tool. Keep the mapping versioned.

Step-by-Step: Load the Target

Disable or defer secondary indexes and FK checks only if your runbook allows it—and re-enable them before cutover.

  • Create staging tables on the target.
  • Bulk load CSV (COPY / LOAD DATA / INSERT batches).
  • Run transform SQL into final tables.
  • Rebuild indexes and validate constraints.
  • Reconcile counts and checksums against source.

Reconciliation Checks

Never declare victory on "it loaded."

-- Counts
SELECT 'users' AS t, COUNT(*) FROM users
UNION ALL
SELECT 'orders', COUNT(*) FROM orders;

-- Aggregate checksum example
SELECT COUNT(*), SUM(amount), MIN(created_at), MAX(created_at)
FROM orders;

-- Orphan children
SELECT COUNT(*) FROM orders o
LEFT JOIN users u ON u.id = o.user_id
WHERE u.id IS NULL;

Cutover Strategies

Pick based on downtime tolerance.

StrategyDowntimeFit
Big bangMinutes to hoursSmall DBs, maintenance window
Load + deltaShort freezeSystems with updated_at / CDC
Dual write then switchNear zeroApp changes required

Real-World Examples

Migrations where CSV carried the weight.

MySQL → PostgreSQL app move

Tables exported with UTF-8 CSV, types normalized on staging, application cut over on a Saturday window after count checks matched.

Legacy ERP extract

Vendor only offered CSV dumps. Team mapped columns in a spreadsheet, cleaned with Convert CSV Online, and loaded into the new warehouse.

Shard consolidation

Multiple shard exports merged, duplicates removed, then loaded into a single primary with upserts.

Common Mistakes

These cause painful rollbacks.

  • Migrating child tables before parents.
  • Ignoring character set differences (utf8mb4 vs UTF-8).
  • Losing boolean/date semantics in Excel mid-flight.
  • No reconciliation beyond "file uploaded."
  • No rollback: source decommissioned too early.

Best Practices

Migration hygiene.

  • Script every export/transform/load step.
  • Keep mapping docs next to the scripts in Git.
  • Dry-run on a full-size copy first.
  • Preserve source until soak time passes.
  • Encrypt files in transit and at rest—CSV is often full of PII.

Why Use Convert CSV Online?

Convert CSV Online is free, browser-based, and requires no account for everyday conversions. Use it to inspect extracts, reshape columns between schemas, convert samples to Excel for stakeholder sign-off, or generate SQL for smaller tables. Client-side workflows work on Windows, macOS, and Linux browsers.

Sample before the full dump

Migrate 1,000 rows end-to-end in the browser-assisted workflow, then scale the same mapping to the full export.

Conclusion

CSV migrations succeed with ordered exports, explicit maps, staging loads, and hard reconciliation—not with hope. Automate the path, verify twice, then cut over.

FAQ

Can I migrate a database using only CSV?

You can migrate table row data with CSV. Schema objects (procedures, triggers, advanced types) need separate handling, but CSV is an excellent bridge for records.

What order should I migrate tables?

Parents before children—follow foreign key dependencies so imports do not create orphan rows.

How do I verify a CSV migration worked?

Compare row counts, aggregate checksums (sums, min/max dates), and FK orphan queries between source and target.

How do I handle schema differences?

Maintain an explicit column map with transforms (rename, cast, split, merge), apply them on staging, then load final tables.

Is CSV safe for PII during migration?

Treat CSV dumps as sensitive: encrypt in transit and at rest, restrict access, and delete intermediates after soak time.

When is CSV the wrong migration tool?

Very large heterogeneous schemas, complex types, or continuous replication needs may require native dump/restore, logical replication, or a dedicated ETL platform.

References

Convert your CSV in the browser

Preview, clean, and convert CSV files free with Convert CSV Online—no installation and no account required for everyday conversions.