-
Notifications
You must be signed in to change notification settings - Fork 9
Partial data import #49
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
base: master
Are you sure you want to change the base?
Conversation
Also references to lookup tables are still hold on the definitions. If we really want to make the lookup an independent feature, we have to put it somewhere else. |
lib/data-import/definition/script.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We split out the Lookup to have a separate entity, that we can reason about. If you think in the terms of a LookupTable it does not care when a row was imported. The method on the lookup should have a more intention revealing name.
I created an id mapping container which holds all id dictionaries. The container is held by the execution plan. I'm not happy the way it is used because I have to pass it to several initializations. @senny any idea on how to change that? May the container is in the wrong place. The syntax to use the id mappings in the blocks is now: id_mapping_for('definition name', 'id lookup name').lookup(old_value)
id_mapping_for('definition name', 'id lookup name').add(old_value, new_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move this class outside the Definition
namespace.
@stmichael I think the IdMappingContainer belongs to the ExecutionPlan. I think the DSL objects should always have access to the plan, which is being built. They are coupled to the plan very tightly anyways because their only intention is to build the plan. So I suggest you pass along the whole plan in place of only the mapping container. I also think you should bridge the methods to add a new dictionary on the ExecutionPlan so that you don't need to reach through the object to grab the container. |
I updated the branch with the discussed changes. @senny If you agree I will go on to the implementation of the partial import |
This is a first version of a partial import. What do you think about it? |
The next step would be to extract the loading and storage of the settings into a separate class to keep it together. Also in the unit test of the partial import I directly write to the settings file as test setup. That's not flexible since it's closely tied to the implementation. |
lib/data-import/definition.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
row_importer
typo
What do you think about it now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use rspec-mocks? Is it not relevant if save was called?
@stmichael I'm a little short on review time at the moment. I have some general spots I'm not that happy with but don't have prepared suggestions how to improve:
|
I started by decoupling the lookup tables from the definitions. It's not finished yet. There is still code that uses lookups on definitions.
@senny what do you think about it so far?