Skip to Content
DataDatabaseImport and Export

Data Import and Export

The Momen database provides efficient data import and export capabilities, supporting bulk data import from external sources (including bulk account creation) and export of database data to standard format files for data migration and backup.

🚀

Supports importing up to approximately 10 million rows of data, with an import speed of up to 100,000 rows per minute.

Import Data

Prepare Data Files

Table file requirements:

  • UTF-8 encoded Excel files (.xlsx only) or CSV files.
  • First row must be headers.
  • Cells intended to be blank must be completely empty (no hidden spaces or line breaks).
  • Must contain at least one data record.
  • No formula calculations are supported.

You can download template tables from the bottom left of the upload interface.

excel_sample

For importing images, videos, and files, prepare an additional ZIP package:

  • Create image, video, and file folders locally to store images, videos, and other files respectively
  • Compress these three folders directly into a ZIP file. Do not wrap them in an extra top-level folder before compressing (the ZIP root should contain the image, video, and file folders, not a single parent directory that contains them).
  • In the CSV or Excel file, multimedia column values should be written as folder_name/filename, e.g. image/cover0.png, file/api.pdf, video/intro.mp4

Supports creating multi-level subfolders within the image, video, and file folders. In this case, the table file needs to include the complete path filename, such as: image/folder0/cover0.png, file/folder1/api.pdf, video/folder2/intro.mp4.

database

Upload Files

Click the Import button in the bottom left corner of the Momen database to enter the data upload interface. Upload the prepared tables and multimedia files (optional). Multiple tables can be uploaded (supports mixed CSV and Excel), but only one multimedia ZIP file is allowed.

entry

upload_file

Select Import Type

Choose Insert or Update. Insert means directly inserting data into the database, while Update updates existing records based on the primary key (id).

Configure Mapping

Mapping consists of:

  • Table Mapping: Maps uploaded tables to database tables. System tables (account tables, payment tables, etc.) are not supported in this flow. Use the dedicated Create accounts flow below for account creation. Each Sheet in Excel and each CSV file corresponds to one table.

  • Field Mapping: Maps columns from uploaded tables to database table fields. Columns that don’t need to be imported can be ignored using the Ignore option on the right side of each row.

mapping

Related Field Mapping

If other tables are related to the current table, related table mapping needs to be configured.

How it works: after a relationship is established, the current table stores the related record ID. During import, match a column in your file to a field on the related table (such as username or email) to resolve the corresponding unique ID.

For example, if there’s a one-to-many relationship between the Account and Post tables, the author column in the Post table stores the ID from the Account table. During import, you can use the author name from the Excel table to find the matching username in the Account table and obtain the corresponding ID.

To prevent ambiguous ID resolution when related lookup values are duplicated (for example, multiple Account rows share the same display name), configure a unique constraint so the field you match on (such as username) is unique in the related table.

unique_constraint

After configuring the unique constraint, when mapping related tables, map the author column from the Excel table to the username field in the Account table. If the constraint includes multiple fields, configure matching for multiple fields.

relation_mapping

relation_mapping

Multimedia Field Mapping

To import multimedia files (images, videos, and files), the corresponding column values in the import table should be written as folder_name/filename, such as image/cover0.png, video/intro.mp4, file/api.pdf.

During import, the system will automatically extract these files from the uploaded ZIP package and store them in the database.

Geographic Coordinate Field Mapping

To import coordinates, first select the coordinate type (WGS84, GCJ-02, or BD-09), then configure latitude and longitude mapping separately. Therefore, the import table needs two columns to store latitude and longitude.

geo_mapping

Data Conflict Handling

When the import mode is Insert and fields have unique constraints, a conflict occurs if duplicate values appear in the imported data (or between imported data and existing rows, depending on your configuration). Conflict handling applies only in these unique-constraint conflict cases.

First, select the constraint:

  • Any Unique Constraint: Triggers conflict handling if any field with a unique constraint conflicts.

  • Specific Unique Constraint: Select a specific unique constraint as the basis for conflict judgment.

The system provides three conflict handling methods:

  • Do nothing: Ignore rows that conflict with the selected unique constraint and continue importing non-conflicting rows. Use case: You can tolerate skipping conflicting rows and prioritize importing the rest first.

  • Update: Use the newly imported data to overwrite existing rows that conflict under the selected unique constraint. Use case: Imported data is the latest source of truth and should overwrite existing values.

  • Terminate: Immediately stop the entire import process and record detailed error information. This option is only available when Any is selected. Use case: You require strict consistency and cannot accept any unresolved unique-constraint conflict.

constraint

Trigger Configuration

If the data table has configured triggers (such as INSERT, UPDATE, or DELETE), you can choose whether to trigger them during import. Import triggers use a whitelist mechanism. During import:

  • Newly added triggers are not triggered unless they are added to the whitelist.
  • Modified triggers are triggered with their updated logic if they remain in the whitelist.
  • Deleted triggers are removed from the whitelist and will no longer be triggered.

Preview Data

After configuration, you can preview the import data. The system displays the first 10 rows of the table for users to confirm data format and content. Multimedia file previews only show filenames, not specific content.

preview

Execute Import and View Results

After confirmation, click the Import button to start the import process. The import process uses temporary storage, which is released automatically when the import completes.

After import, the system will indicate success or failure. Detailed import results, including successful entries, can be viewed in History. If records were skipped (due to conflict handling) or failed (due to data or system errors), the system provides a downloadable log file (retained for 7 days) with detailed records and error reasons. If import fails, first check failure details in History, then use Import Error Handling to quickly locate the issue.

To ensure data integrity, if the import encounters a system or data error (for example, a type mismatch), the operation is atomic: none of the data from this batch will be written to the database. Records intentionally skipped via conflict handling do not trigger this rollback.

import_result

log

Import Accounts

Bulk account creation supports creation only and does not support updating existing accounts by id.

Enable Sign-in Method

Bulk account creation is essentially a bulk call to the account registration API, so it directly depends on the sign-in methods enabled in your project.

In Settings → Sign in, you can enable username, email, and phone sign in for account creation.

When multiple sign in methods are enabled, imported data can include any one sign in method, or multiple sign in methods at the same time.

Prepare Account File

Prepare a table file containing fields related to the sign in methods. File format requirements are the same as Prepare Data Files:

  • UTF-8 encoded Excel files (.xlsx only) or CSV files.
  • First row must be headers.
  • Cells intended to be blank must be completely empty (no hidden spaces or line breaks).
  • Must contain at least one data record.
  • No formula calculations are supported.

You can also fill in a template file downloaded from the lower-left corner of the Import accounts upload interface.

Only four fields are supported for import: username, email, phone_number, and password. Other fields (such as profile_image) are not supported.

Upload File

Click Import accounts in the lower-left corner of the Momen database, then upload the prepared file in the upload interface. Bulk account creation supports only one file per run.

Configure Mapping

Field mapping must satisfy the following rules:

  • The Password field is required.
  • At least one of the following fields is required: username, email, or phone_number.

Sensitive account data is not stored directly in the account table, but in an internal credential table. During import, data is first written to the credential table and then automatically synchronized to corresponding fields in the account table.

Data Conflict Handling

username, phone_number, and email all have unique constraints. When imported data conflicts with existing database data (duplicate in any unique field), you can choose:

  • Do nothing: Ignore conflicting records and continue importing non-conflicting records. Use case: You can tolerate a small number of duplicate accounts and prioritize completing bulk import.
  • Terminate: Stop the entire import process immediately. Use case: You require strict account uniqueness and prefer manual verification once conflicts are detected.

Trigger Handling

If database triggers are configured on the account table, you can choose whether to trigger them during import. Import triggers use a whitelist mechanism. During import:

  • Newly added triggers are not triggered unless they are added to the whitelist.
  • Modified triggers are triggered with their updated logic if they remain in the whitelist.
  • Deleted triggers are removed from the whitelist and will no longer be triggered.

Preview Data

After configuration, you can preview import data. The system displays the first 10 rows for format and content verification.

Execute Import and View Results

After confirmation, click Import to start.

After import, detailed results are available in History. If some data was skipped or fails, a downloadable log file (retained for 7 days) is provided for troubleshooting.

If import fails, first check failure details in History, then use Import Error Handling to quickly locate the issue.

Conflict handling vs. import errors: Do nothing and Terminate apply only when a unique-constraint conflict is detected for accounts. If the import encounters an error during processing, the operation is atomic: no data from this import batch is written to the database.

Data Export Process

Configure Export Options

  • Export Format: CSV or Excel (.xlsx). When exporting both the current table and related tables, CSV format will generate multiple independent CSV files, while Excel format will generate a single file containing multiple workbooks.

  • Export Multimedia Files: When enabled, the system will package all related multimedia files (images, videos, files) into a ZIP archive for export. The archive contains IMAGE, VIDEO, and FILE folders for storing corresponding media content.

Select Data Range

  • Select Data Table: Supports all system tables, custom tables, and custom views
  • Configure Filter Conditions: Set filtering, sorting, and deduplication conditions to precisely filter export data
  • Select Export Fields: Freely choose fields from current and related tables

exporting

Execute Export and View Results

After configuration, click the Export button to start the export. Export files can be viewed and downloaded in the History records, with files retained for 7 days.

Import Error Handling

Import logs provide detailed error information, including filename, worksheet name, specific row numbers, and error descriptions, facilitating precise location and troubleshooting. Log line numbers correspond to actual table line numbers, with table data starting from row 2 (row 1 being the header), and logs also reporting from row 2.

The following list contains common errors only and is not a complete error code reference. Error strings below reflect values as they may appear in logs; casing can vary by error type.

Error MessageCauseSolution
NO_MATCHING_MEDIACorresponding multimedia file not found, possibly due to non-standard directory structure or incorrect file-data matching.1. Check whether the multimedia directory layout matches the requirements.
2. Verify that paths in the table use the correct folder_name/filename format.
3. Confirm that each path in the table matches an actual file in the ZIP.
unique_constraint_violationImport data conflicts with unique constraints.1. Remove or fix duplicate values in the source data.
2. Adjust conflict handling (for example Do nothing or Update) for the affected unique constraint in the import configuration.
MISMATCHED_DATA_TYPEData type mismatch.Update the table values so each cell matches the target field’s data type.
INTERNAL_ERRORVarious possible causes, such as a non-UTF-8 encoded ZIP package.Re-create the archive with UTF-8-safe tooling (for example Bandizip) and retry.
Last updated on