Import command
Import data from a file to your Convex deployment.Usage
Arguments
Path to the input file containing data to import.
Options
Destination table name.Required if format is
csv, jsonLines, or jsonArray.Not supported if format is zip.Input file format. Required only if the filename is missing an extension.Choices:
csv, jsonLines, jsonArray, zip- csv - CSV files must have a header. Each row’s entries are interpreted as numbers or strings.
- jsonArray - JSON files must be an array of JSON objects.
- jsonLines - JSON Lines files must have a JSON object per line.
- zip - ZIP files must have one directory per table, containing
<table>/documents.jsonl. Snapshot exports from the Convex dashboard have this format.
Replace all existing data in any of the imported tables.Conflicts with
--append and --replace-all.Append imported data to any existing tables.Conflicts with
--replace and --replace-all.Replace all existing data in the deployment with the imported tables.
- Deletes tables that don’t appear in the import file or schema
- Clears tables that appear in the schema but not in the import file
--append and --replace.Skip confirmation prompt when import leads to deleting existing documents.
Path to the component in the component tree defined in
convex.config.ts.Examples
Import from a snapshot
Import data from a snapshot ZIP file:Import a single table from JSON
Import JSON array into a specific table:Import from CSV
Import CSV data with headers:Replace table data
Replace all existing data in the imported tables:Import to production
Import to your production deployment:Export command
Export data from your Convex deployment to a ZIP file.Usage
Options
Path for the exported ZIP file.May be a directory or an unoccupied
.zip path.Include stored files in a
_storage folder within the ZIP file.Files are stored via the file storage API (accessible at /deployment/files in the dashboard).Examples
Export all data
Export all database tables to a ZIP file:Export with file storage
Include uploaded files in the export:Export from production
Export data from your production deployment:Export to directory
Export to a directory (the CLI will create a timestamped ZIP file):Deployment selection
Both import and export commands support deployment selection options:--prod- Target production deployment--preview-name <name>- Target a preview deployment--url <url>- Target a specific deployment URL--admin-key <key>- Admin key for authentication