Lesson 3.1: Choosing the right import or export tool
The documentation's rule is plain: use the tools that exist first, and write a script only for what they cannot do. This lesson gives learners a map of those tools, what each reads and writes, and the table that matches a source to its first choice.
At a glance
| Course | Migrating to Exponential |
| Module | Module 3: Import and export tools |
| Duration | 45 minutes (20 presenting, 25 exercise) |
| Level | Intermediate |
| Audience | Developers and administrators |
| Prerequisites | Module 2; a training installation with shell access and an administrator account |
Learning objectives
After this lesson, learners can:
- name the import tools of Exponential and what each reads;
- name the export tools and what each writes;
- choose the first tool for a given source from the table "Which tool for which job";
- list the classes and the export columns of their installation with xrowextract, without writing anything.
Trainer's notes
How to present it
Source: Exponential's import and export tools, sections 1, 2 and 5.
- Import tools (8 minutes). In one sentence each:
- xrowextract: the most complete importer; reads CSV, XML or JSON, creates or updates objects of one class below a parent node; dry run by default; background jobs and resume.
- ezcsvimport (kernel): simple;
;separator, no header row, create only. - Packages (
.ezpkg): classes and content between Exponential installations. - The ZIP importer of the upload page (ezmultiupload): a media library in bulk.
- ezodf: office documents.
- RSS import: keeps pulling a feed in during a transition; not a full migration.
- exp:layouts: layouts and rules as a ZIP transfer file between Exponential installations.
- REST and expservices: when the importer runs on another machine.
- 7x SQLI Import (an extension, installed separately): imports defined in the administration, without code, from CSV, spreadsheets, feeds, JSON and REST APIs, databases and the export files of WordPress, Drupal and Joomla; dry run, schedules, undo of a run within 30 days (7x SQLI Import: start here).
- Export tools (5 minutes). Show the table of section 2: xrowextract CSV and site archive, packages, the CSV export of the kernel, layouts export, bccie for form data, the database dump.
- Which tool for which job (4 minutes). Show section 5. A spreadsheet goes to xrowextract with
--map; a system with a REST API only needs a custom script (lesson 3.3). - One honest sentence (3 minutes). The tools that ship with every installation do not read WordPress, Drupal or Joomla exports directly; the path guides convert them into a format xrowextract reads, or use the script skeleton. Where the extension 7x SQLI Import is installed, it reads those exports itself (a WordPress WXR file, Drupal JSON:API, Joomla), with a dry run first.
Common questions
Is xrowextract part of every installation? It is required by the root composer.json of Exponential 6.0.15, like
the other extensions the tools page names. Tools of an extension are available when it is installed and active.
Why not import through REST? The tools page: for large imports a script on the server is faster and simpler. REST (create, update and delete at v2) is for an importer that runs on another machine.
Can packages carry content from WordPress? No. Packages are the tool for moving between Exponential installations; they are not a format other systems produce.
Pitfalls
- Writing a script on day one. Check the tools first; a CSV and
--mapoften do the job. - Using ezcsvimport for an update. It only creates. A second run duplicates.
- Forgetting the files. Exports reference images and files in the storage directory; copy it with them.
Hands-on exercise
Use your own training installation. Every command in this exercise only reads.
In the installation root, list the classes that have objects below the root node:
php bin/php/console ext:xrowextract:csv --list-classes --node=2List the columns xrowextract can export for the class
article(or a class from step 1):php bin/php/console ext:xrowextract:csv --list-columns --class=articlePreview the first rows of an export with the migration column set, without writing a file:
php bin/php/console ext:xrowextract:csv --class=article --node=2 --sets=migration --preview=3Note the columns that identify each row (object id, remote id) and the ones that place it in the tree (parent remote id, priority).
In the admin, open Setup > Packages and note which packages your installation has.
For each source below, write the first tool and the second tool from section 5 of the tools page: a spreadsheet of 400 products; a folder of 2 000 photos; another Exponential 6 site; a news feed; a system with only a REST API.
Expected result
- Step 1 lists classes with object counts; step 2 lists attribute identifiers and special columns.
- Step 3 prints three rows whose columns include the object id, the remote id, the class identifier, the language, the parent's remote id and every attribute.
- Step 6: xrowextract with
--map; the ZIP importer; packages (or a database copy when the whole site moves); RSS import; a custom script with the kernel API. - The trainer checks step 3 on one screen and the five answers of step 6.
Quiz
- Which tool imports a CSV whose columns you name with
--map, with a dry run by default? A. ezcsvimport B. xrowextract C. ezodf D. RSS import - What does the kernel's ezcsvimport do with an existing object on a second run?
- Which tool moves layouts and their rules between Exponential installations?
- True or false: packages are a good format for content coming from WordPress.
- Why is a server-side script usually better than REST for a large import?
Answers
- B (tools page, section 1).
- Nothing: it creates only, so a second run makes a duplicate (tools page, section 1,
ezcsvimport). exp:layouts exportandexp:layouts import(tools page, section 1).- False. Packages move content between Exponential installations; other systems do not produce them (tools page, section 1).
- It is faster and simpler; REST is for an importer on another machine (tools page, section 1, "The REST API and expservices").
Further reading
- Exponential's import and export tools: every tool with its real options.
- Packages: packages in the admin and from a shell.
- Remote services and apps: the HTTP services for importers on another machine.
Related pages
- Module 3: Import and export tools
- Migrating to Exponential: course overview
- Trainers: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.