Looking at the node.js sequelize sample : https://github.com/mirkojotic/node-sequelize-article/blob/master/index.js
In this code, I use sqlite for just simple playing around.
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: './database.sqlite'
});
Unfortunately, data table will be locked when continue insert data in the same table.
const tags = body.tags.map(
tag =>
Tag.findOrCreate({
where: { name: tag.name },
defaults: { name: tag.name }
}).spread(
(tag, created) => tag
)
);
The error could be one of the two following messages:
Unhandled rejection SequelizeDatabaseError: SQLITE_ERROR: cannot start a transaction within a transaction
Unhandled rejection SequelizeTimeoutError: SQLITE_BUSY: database is locked
The sqlite is in memory database, so it has fast transaction.
I don't face this kind of issue, when I was working on python django.
So, mostly I realize think this is node.js sqlite module implementation issue.
No comments:
Post a Comment