activerecord-import icon indicating copy to clipboard operation
activerecord-import copied to clipboard

A library for bulk insertion of data into your database using ActiveRecord.

Results 36 activerecord-import issues
Sort by recently updated
recently updated
newest added

I've just spent a fair amount of time tracking down an issue that manifested in our app as ``` PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint ```...

feature-request

Thanks for the awesome library. It took me a while to find the index_predicate option for on_duplicate_key_update. Could you add an example to the README?

docs

It would be nice if there was a method like import_to_sql or something that would return the SQL string and not run the command against the database. I'm not sure...

feature-request

I'm using `1.0.5` with Postgres 12.3. ``` user_hashes = {name: "John", verified_at: Time.now } outcome = User.import( user_hashes, validate: false, returning: [:name, :verified_at] ) puts outcome.results => [ 1, "John",...

I'm using a [set](https://ruby-doc.org/stdlib-2.7.1/libdoc/set/rdoc/Set.html) to create a uniq list of AR records to upsert into my database. It appears that there is a direct test for Array in https://github.com/zdennis/activerecord-import/blob/a0d612be2137c3c659943434551a7bbd14d43352/lib/activerecord-import/import.rb#L142 Would...

Contrived example: ```ruby class Category < ActiveRecord::Base end class Post < ActiveRecord::Base belongs_to :category, optional: false end Post.create!(category_id: nil) #=> ActiveRecord::RecordInvalid: Validation failed: Category must exist Post.create!(category_id: -1) #=> ActiveRecord::RecordInvalid:...

docs

It would be great if the `returning:` option supported raw SQL so I could use `returning: "id, (xmax = '0') AS inserted"` to check to see if the row was...

feature-request
lets-implement
postgresql

I am trying to import products and save images through remote urls. Import works well, but I can't manage it to make it work work ActiveStorage images. Is this supported...

feature-request
lets-implement

The `import` aliases defined by this gem prevent the `import` method from `elasticsearch-model` from being added to a project's active record models. Why? Because with `elasticsearch-model`, you cause an `import`...

feature-request
docs

Hi, I found that recursive import with hashes is not supported (https://github.com/zdennis/activerecord-import/issues/522#issuecomment-397033165) and this is ok, but it took me a little while to realize this after getting a fairly...

docs