73 lines
2.1 KiB
Plaintext
73 lines
2.1 KiB
Plaintext
---
|
|
title: Database Export
|
|
description: Export database structure and data as SQL for backup, migration, or test datasets.
|
|
---
|
|
|
|
Database Export writes table structure and table data into a SQL file. Use it before high-risk operations, for small database migrations, or to create reproducible development and test datasets.
|
|
|
|
## What Gets Exported
|
|
|
|
| Content | Details |
|
|
|---|---|
|
|
| Structure | `CREATE TABLE`, columns, primary keys, indexes, constraints, and other DDL |
|
|
| Data | Rows exported as `INSERT` statements |
|
|
| Batched inserts | Multiple rows grouped into one `INSERT` to reduce file size and import overhead |
|
|
|
|
Example:
|
|
|
|
```sql
|
|
INSERT INTO users (id, name, email) VALUES
|
|
(1, 'Alice', 'alice@example.com'),
|
|
(2, 'Bob', 'bob@example.com'),
|
|
(3, 'Carol', 'carol@example.com');
|
|
```
|
|
|
|
## Workflow
|
|
|
|
<Steps>
|
|
<Step>
|
|
### Select Connection and Database
|
|
|
|
Choose the database to export and verify the environment.
|
|
</Step>
|
|
<Step>
|
|
### Configure Export Options
|
|
|
|
DBX currently exports up to `10,000` rows per table. Tables that hit the limit are marked as truncated in the generated file.
|
|
</Step>
|
|
<Step>
|
|
### Choose Output Location
|
|
|
|
Select where the `.sql` file should be saved.
|
|
</Step>
|
|
<Step>
|
|
### Start Export
|
|
|
|
DBX generates a SQL file containing structure and data.
|
|
</Step>
|
|
</Steps>
|
|
|
|
## Row Limits
|
|
|
|
Database export currently uses a fixed `10,000` rows per table limit. This is useful when:
|
|
|
|
- You only need schema plus sample data
|
|
- Full table data is too large to export
|
|
- You are creating a smaller dev or test dataset
|
|
- You need a minimal reproduction file for debugging
|
|
|
|
## Importing the Export
|
|
|
|
The generated `.sql` file can be imported with [SQL File Execution](/en/docs/sql-file).
|
|
|
|
<Callout type="warn">
|
|
Export files may contain sensitive data, account information, business identifiers, or user privacy data. Mask data before sharing when needed.
|
|
</Callout>
|
|
|
|
## Recommendations
|
|
|
|
- Export a backup before high-risk schema operations
|
|
- Test imports in a non-production database before migration
|
|
- Use native database backup tools for large production databases or complete backups
|
|
- Keep exported SQL files out of public repositories
|