-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide option to add an item together with all its dependencies #306
Comments
I found out that when importing scenario-alternatives, we import all necessary scenarios and alternatives. That has two problems in my opinion:
So if nobody disagrees I will disable importing scenarios and alternatives automatically when importing scenario-alternatives. It will be controlled by a keyword argument or something like that. Any thoughts @jkiviluo @soininen ? |
Can you clarify:
In my view, that last one should be controlled by the user (to keep typos at bay using b). Is this what you were also thinking? |
Yes
One can add a scenario without any alternatives (add_scenario_item). The scenario_alternative items are added later on via a separate method (add_scenario_alternative_item). The same should be valid for import, otherwise it's just weird. You should import your scenario, alternative, and scenario_alternative items individually. |
Right. I was just thinking of a scenario where one is copying from one DB to another. However, you probably mean that when one is programmatically creating scenarios, then one could make the scenario first and only then add the scenario_alternatives. So, yes, there should be an option to not import associated scenario-alternatives, when importing scenarios. And the default API behaviour should be the same as elsewhere (do not import dependents automatically). In the importer tool the default might be other way around (since it usually makes sense to get the alternatives with the scenario - the alternatives are what really form the scenario). |
We should indeed be consistent i.e. not create non-existent alternatives when adding scenario-alternatives by default. |
The idea is e.g. when adding a parameter value for an entity or parameter definition that don't exist yet, the entity and parameter definition get optionally created - in other words, anything needed so the parameter value can exist.
So this should be controlled via an additional keyword argument for add_item and also for add_update_item.
At the moment, the ImportMapping class provides this functionality for some of the items (entities and entity groups) but not for all. After this change then, the ImportMapping should be using the new convenience developed.
The text was updated successfully, but these errors were encountered: