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

QUESTION: Difference between ActiveRecord-Import & upsert_all in Rails 7? #772

Open
OskarEichler opened this issue Jun 22, 2022 · 2 comments

Comments

@OskarEichler
Copy link

OskarEichler commented Jun 22, 2022

Hey guys,
Great work on this gem! We've been using it for the past few years and recently upgraded to Rails 7. With Rails 7 comes quite a few new config options for upsert_all, and I wanted to know what exactly the differences are now that still exist between ActiveRecord-Import and upsert_all?

@jkowens
Copy link
Collaborator

jkowens commented Jun 22, 2022

I definitely recommend switching to the Rails default upsert_all. I don't have a list of all the differences but I think a couple things may be the "recursive" import option for Postgres users and also the ability to import models that can be validated before import. Those are ar-import features.

@OskarEichler
Copy link
Author

OskarEichler commented Jun 22, 2022

Did a bit more research on upsert_all, and definitely see a couple of downsides that maybe others can comment on:

  • There still is no synchronize method in core Rails that I'm aware of?
  • The returned results from upsert_all are not Models but just an array of hashes.
  • There is no good way of doing run_callbacks since the returned result is not an array of models.

Kind of thinking to just stick with ActiveRecord-Import since it feels much more refined, but maybe more people can chip in here to get a better sense of the pro's and con's.

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

No branches or pull requests

2 participants