I have an ERP system with a database that holds more or less 400,000 items.

I need the 400,000 items to be migrated to my Magento 2.1.3 database.

Is it possible to directly import items from my ERP database to magento's using an sql query? Will all thats needed after be to run the indexer to have the pages displayed?

What is the correct procedure for a direct import? Is there any example SQL out there someone has on hand to show me how its done?


  • Easy way to import product in magento2 with .csv file in magento default import/export feature.
    – user15917
    Mar 29, 2017 at 5:16
  • It is possible to import products using only SQL, but complex once you start dealing with attributes, category assignments, etc. You have to keep track of ids to make the appropriate updates to related tables.
    – jiheison
    Sep 23, 2019 at 1:39

3 Answers 3


I think the following procedure will work for you:

  • First, create all needed product attributes(manually or using web api)
  • Use webapi or import to add your products in Magento
  • Launch full reindex for all indexers

Also, data migration tool(http://devdocs.magento.com/guides/v2.0/migration/migration-tool-install.html) might be useful for big catalogs. Out of the box, this tool is able to migrate M1 to M2. However, this tool is extensible ETL solution, so you can create your own migration rules. Using these rules you can move any column from one database to another(m2), rename tables, modify values etc.


We used the Magento REST API to import products, categories and customers.

Example REST API usage for calling Magento Search:

$ curl http://ex-magento-site.com/rest/V1/search

We decided to build a webapi extension to give us access to custom functionality so we exposed /import rather than /search.

This works well with importing 20k products, 100 categories and 4k customers.


You cannot import any products from direct sql query, It is possible but it is lazy and due to complex attributes. You import same products all details even images from magento2 import tool. Where you can import 30k-40k products in 2-3 hours. Keep in mind you should add import categories and images or if you have 100+ custom attributes means***(Images, Categories and custom attributes) you be imported in 2nd phase.***

It can take 15 to 20 days if you have 400k products and validated all.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.