You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, from what I can tell, this library requires a changeset for all inserts.
We have a use case where we need to create 10s of thousands of records using insert_all that makes use of a polymorphic_embeds field.
We are using insert_all for performance reasons as looping through and making 10k inserts is an issue.
This results in the following error
| ** (RuntimeError) polymorphic_embed is not able to add an autogenerated key without casting through cast_polymorphic_embed/3
| (polymorphic_embed 2.0.1) lib/polymorphic_embed.ex:282: PolymorphicEmbed.dump/3
| (ecto 3.9.2) lib/ecto/type.ex:941: Ecto.Type.process_dumpers/3
| (ecto 3.9.2) lib/ecto/repo/schema.ex:1006: Ecto.Repo.Schema.dump_field!/6
Currently, from what I can tell, this library requires a changeset for all inserts.
We have a use case where we need to create 10s of thousands of records using insert_all that makes use of a polymorphic_embeds field.
We are using
insert_all
for performance reasons as looping through and making 10k inserts is an issue.This results in the following error
When using
embeds_many
, the same problem can exist BUT if you pass in a struct with all the necessary fields, the insert succeeds - this is discussed here: https://elixirforum.com/t/using-repo-insert-all-when-your-schema-has-embeds-many/14219Is there a way to force a known json blob into the field when using insert_all?
Many thanks!
The text was updated successfully, but these errors were encountered: