deivid-rodriguez/pry-byebug

Runing import without passing it through ID fetcher

TikiTDO opened this issue · 1 comments

Both import_scope here and import_objects here re-run a select, regardless of what I pass in. For a more complex index, this can translate to a bunch of queries per instance that I want to import.

I would like to import a record with the necessary data included in order to avoid extra queries, but this seems to be impossible with the options available. The only way I can do this right now is by skipping any sort of external API, and just doing an import directly:

some_scope.find_each(batch_size: 1000) do |batch|
  routine = Chewy::Type::Import::Routine.new(SomeIndex::SomeModel, {})
  routine .process({index: batch})
end

I would really prefer not to have to resort to something like this, so would it be possible to introduce either a key that skips the re-import, or some way to customize the default_scope used when re-loading the data to be imported?

Er, had the wrong repo open. Sorry about that.