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
I'm trying to create insert a series of entries at once using Multi.insert_all (Multiple :experiment_status need to be created after their associated :experiment is created).
I believe that I've filled out every field of the model in each changeset/map to be inserted (except for the id field of the :experiment_status itself, of course):
However, I get an error upon Repo.transaction(multi), which is "Cell-wise default values are not supported on INSERT statements by SQLite".
I took a look at the source code of sqlite_ecto2. The error is on line 155 of lib/sqlite_ecto/connection.ex but I couldn't easily understand this error, since it doesn't pinpoint the exact cause:
** (ArgumentError) Cell-wise default values are not supported on INSERT statements by SQLite
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:155: anonymous fn/2 in Sqlite.Ecto2.Connection.insert_each/2
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:871: Sqlite.Ecto2.Connection.intersperse_reduce/5
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:146: anonymous fn/2 in Sqlite.Ecto2.Connection.insert_all/2
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:871: Sqlite.Ecto2.Connection.intersperse_reduce/5
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:145: Sqlite.Ecto2.Connection.insert_all/2
(sqlite_ecto2) lib/sqlite_ecto/connection.ex:132: Sqlite.Ecto2.Connection.insert/6
(sqlite_ecto2) lib/sqlite_ecto.ex:37: Sqlite.Ecto2.insert_all/7
(ecto) lib/ecto/repo/schema.ex:52: Ecto.Repo.Schema.do_insert_all/7
I don't think I'm asking for any default value... except for maybe the ID field of :experiment_status, which should be automatically generated.
Should I just try to do without insert_all on a list of raw maps, and instead create and insert changesets one by one? That would seem to be a quite unwiedly way to use Ecto.Multi. I just wonder what caused the issue and whether Ecto's insert_all could be used at all with SQLite.
The text was updated successfully, but these errors were encountered:
After changing to Multi.insert and creating/inserting the changesets one by one it worked. Still not sure what caused the issue in the first place though. Guess some Ecto functions are designed to work better with Postgres than with SQLite.
I'm trying to create insert a series of entries at once using
Multi.insert_all
(Multiple:experiment_status
need to be created after their associated:experiment
is created).I believe that I've filled out every field of the model in each changeset/map to be inserted (except for the
id
field of the:experiment_status
itself, of course):The migration used to create the
:experiment_status
table:However, I get an error upon
Repo.transaction(multi)
, which is "Cell-wise default values are not supported on INSERT statements by SQLite".I took a look at the source code of
sqlite_ecto2
. The error is on line 155 oflib/sqlite_ecto/connection.ex
but I couldn't easily understand this error, since it doesn't pinpoint the exact cause:I don't think I'm asking for any default value... except for maybe the ID field of
:experiment_status
, which should be automatically generated.Should I just try to do without
insert_all
on a list of raw maps, and instead create and insert changesets one by one? That would seem to be a quite unwiedly way to useEcto.Multi
. I just wonder what caused the issue and whether Ecto'sinsert_all
could be used at all with SQLite.The text was updated successfully, but these errors were encountered: