Skip to content
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

Add support for direct_import parameter to skip objects reloading #753

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

dalthon
Copy link
Contributor

@dalthon dalthon commented Feb 8, 2021

Just a rebase of #637 with added spec and a small fix regarding id types

@dalthon dalthon force-pushed the import_objects branch 2 times, most recently from 53c647e to 6af1cba Compare February 8, 2021 16:29
lib/chewy/type/adapter/orm.rb Outdated Show resolved Hide resolved
lib/chewy/type/import.rb Outdated Show resolved Hide resolved
spec/chewy/type/adapter/active_record_spec.rb Show resolved Hide resolved
lib/chewy/type/import.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@rabotyaga rabotyaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the option to the Chewy::Type::IMPORT_OPTIONS_KEYS ? I think otherwise it would be impossible to use it in default_import_options.

@dalthon
Copy link
Contributor Author

dalthon commented Feb 9, 2021

@rabotyaga I was checking values at Chewy::Type::IMPORT_OPTIONS_KEYS then I realized that those are not matching with method import options:

< consistency
> direct_import
< pipeline
< raw_import
< refresh
< replication
> parallel
> suffix
> update_failover
> update_fields

Do you think that the same applies for parallel, suffix, update_failover and update_fields?

@rabotyaga
Copy link
Contributor

rabotyaga commented Feb 10, 2021

@dalthon refresh, consistency, replication & pipeline belong to Routine:

BULK_OPTIONS = %i[
suffix bulk_size
refresh timeout fields pipeline
consistency replication
wait_for_active_shards routing _source _source_exclude _source_include
].freeze

raw_import is passed to orm adapter.
Let's leave missing import keys like update_failover & update_fields since nobody complains.

And let's add CHANGELOG entry.

@dalthon
Copy link
Contributor Author

dalthon commented Feb 10, 2021

@rabotyaga changelog added

@rabotyaga rabotyaga changed the title Add support for direct_import parameter to skip loading default scope on import Add support for direct_import parameter to skip objects reloading Feb 10, 2021
…pe on import

* Skimpier direct_import
* Fix linter error in orm.rb
* Add spec and fixed an issue related to ids
* Update lib/chewy/type/import.rb
* Allow direct_import as default import options
* Update CHANGELOG.md
* Add a note about default `direct_import` value
* Improve error messages in db_queries helpers

Co-authored-by: Ivan Rabotyaga <ivan.rabotyaga@toptal.com>
Co-authored-by: Dalton Pinto <dalton.pinto@toptal.com>
@dalthon dalthon merged commit cd71c83 into master Feb 10, 2021
@dalthon dalthon deleted the import_objects branch February 10, 2021 10:44
cyucelen pushed a commit to cyucelen/chewy that referenced this pull request Jan 28, 2023
…pe on import (toptal#753)

* Skimpier direct_import
* Fix linter error in orm.rb
* Add spec and fixed an issue related to ids
* Update lib/chewy/type/import.rb
* Allow direct_import as default import options
* Update CHANGELOG.md
* Add a note about default `direct_import` value
* Improve error messages in db_queries helpers

Co-authored-by: Tikhon Botchkarev <tikhon.b@sereth.com>
Co-authored-by: Ivan Rabotyaga <ivan.rabotyaga@toptal.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants