What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

hello all, How do we define importers order ? so let’s say I have a data importer X the needs data

UM9F81RCP
UM9F81RCP Posts: 516 🧑🏻‍🚀 - Cadet

hello all,

How do we define importers order ? so let’s say I have a data importer X the needs data from a tabel that will be populated by another importer Y. In this case importer Y has to be executed before importer X.

How do we define this order? I tried to place the command in the needed order in ConsoleDependencyProvider.php but this does not seem to help? Any other suggestions ?

Thanks

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Run specific importers in needed order instead of running import of everything?

  • UM9F81RCP
    UM9F81RCP Posts: 516 🧑🏻‍🚀 - Cadet

    hmmm ok

  • UM9F81RCP
    UM9F81RCP Posts: 516 🧑🏻‍🚀 - Cadet

    is there an easier solution?

  • ULL0N440J
    ULL0N440J Posts: 184 🧑🏻‍🚀 - Cadet

    You can run imports separatley (vendor/bin/console data:import:*)

    We wrote our own importer script. In our scenario we only need some imports daily (products, prices, images, stock etc.). There's no need to run not required imports over and over again (like customer data)

  • UM9F81RCP
    UM9F81RCP Posts: 516 🧑🏻‍🚀 - Cadet

    I see

  • UM9F81RCP
    UM9F81RCP Posts: 516 🧑🏻‍🚀 - Cadet

    thank you guys

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    I think more reliable approach would be:
    insert things into queue with importer1
    consume the events from importer1 by importer2, then do something about the elements that needs action

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    in that case you could run those 2 any time you want, because importer2 would pick up anything it can find and do something about it

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    U can define the order of importer direct in DataImportBusinessFactory (for the importer developed on project level) and for the importer defined and registered as plugin u have to do like the category
    [new CategoryDataImportPlugin(), DataImportConfig::IMPORT_TYPE_CATEGORY_TEMPLATE], (as array and the second entry of array means that the import type category need to be ordered after the category template, because it need category template before.

    U can see the order logic here -> vendor/spryker/data-import/src/Spryker/Zed/DataImport/Business/Model/DataImporterCollection.php:76

    On our Project we defined an extra ordering list (list of import type) and we order all data importer directly in the business factory at the end of this function src/Pyz/Zed/DataImport/Business/DataImportBusinessFactory.php:332