How to Sync Data Using CLI
How to Sync Data Using CLI
You can use the `katana:import:full` CLI command to manually trigger synchronization from Katana PIM into Magento. This is useful for debugging, deployments, or syncing specific data types on demand.Basic Usage CLI
Full Synchronization: Attributes, Categories, Products & Assets
To run a full synchronization, execute:
bin/magento katana:import:full
What This Command Does
- Fetches the latest data from Katana PIM via API.
- Updates data in Magento — only if allowed by config (see below).
- Optionally performs reindexing.
- Removes outdated products/categories/assets if necessary (CLI-only).
If no options are passed, all entities are synchronized.
CLI Options
You can limit the import to specific entities by passing one or more flags:
Option | Description |
---|---|
--attributes |
Sync attributes only |
--categories |
Sync categories only |
--products |
Sync products only |
--assets |
Sync media assets (images) only |
You can combine options to control exactly what is imported.
Examples
Sync only products
bin/magento katana:import:full --products
Sync attributes and categories only
bin/magento katana:import:full --attributes --categories
How the Sync Works
Synchronization Phases
Each selected section goes through two phases:
1. Fetch data from Katana PIM
Example CLI output:
Update Katana Products... 4000/61151 [=>---------------------------] 6% 56 secs 398.5 MiB
This step pulls in the most recent data from the Katana PIM platform.
2. Update data in Magento
Once the Katana data is imported, it’s processed and used to create or update Magento entities. Example:
Update Magento Attributes... 989/989 [==============================] 100% 3 secs 94.5 MiB => Executed successfully
Controlled by Configuration
Whether Magento is allowed to create new entities is controlled by the following settings:
- Create new categories:
Stores > Configuration > KatanaPIM > Automation > Auto create new categories
- Create new products:
Stores > Configuration > KatanaPIM > Automation > Auto create new products
If these are disabled, Magento will skip creation/update for those entities, even though data is fetched from Katana.
Cleanup of Deleted Entities (CLI Only)
Delete-Check After Full Sync
After a full CLI sync, the system checks whether any products, categories, attributes, or assets should be removed from Magento.
This comparison is based on what was fetched from Katana vs. what exists in Magento.
This delete-check only runs when using the CLI. It does not run during cron-based syncs.
Reindexing
Index Mode Recommendation
If the setting "Auto reindex after sync" is enabled (under Katana configuration), Magento will automatically trigger a full reindex after the import. This ensures your storefront immediately reflects the new data.
We strongly recommend setting all indexers in Magento to:
Update on Schedule
You can check current indexer modes:
bin/magento indexer:show-mode
Set all indexers to schedule mode:
bin/magento indexer:set-mode schedule
Why?
- With "Update on Save", Magento triggers reindexing after every entity import, which is extremely slow for large catalogs.
- With "Update on Schedule", indexing runs efficiently in the background or via cron.