Preview feature feedback: Efficiently `createMany` records at once.
See original GitHub issuePlease share your feedback about the createMany
functionality that was released in v2.16.0 in this issue.
Documentation is here.
- If you encounter a bug, please open a bug report in this repo.
- If the feature is working well for you, please share this in a comment below or leave a 👍 on this issue.
If you have any questions, don’t hesitate to ask them in the #prisma-client
channel in the Prisma Slack.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Prisma Client and Prisma schema preview features
When we release a new Prisma Client or Prisma schema feature, it often starts in preview so that you can test it and...
Read more >Performance Improvements in .NET 7
NET 7 is fast. Really fast. This post deep-dives into hundreds of performance improvements that contributed to that reality.
Read more >laravel too slow to update 1k records - Laracasts
Yes, I am using MySQL and I used artisan to create tables in MySQL. Copy Code Schema::create('products', function (Blueprint $table) ...
Read more >Top features in Tabular Editor 3 to boost your Power BI ...
Looking to boost your Power BI development? · Tabular Editor 3 — The best tool for Power BI development! · #1 Advanced Scripting...
Read more >Bulk Inserting Data with Prisma's createMany Method - YouTube
This method allows developers to bulk insert data instead of looping over a dataset and creating records one at a time.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Very nice feature, thanks!
I see we can use the
skipDuplicates
that performs “ON CONFLICT … DO NOTHING”, but it will be nice to have the other possibilities the Postgres provides, for example: “ON CONFLICT (did) DO UPDATE…” or “ON CONFLICT ON CONSTRAINT my_custom_pkey DO UPDATE…”. This would allow us a sort of “upsert” for the “bulk create”.Questions/suggestions:
skipDuplicates
, I would provide the optiononConflict
and the values for this key: “raise”, “replaceAll”, “replaceAllExceptFields”, “nothing”.@ricardoalmeida agreed. Probably a separate
upsertMany
function would fit better with the current API.Another very handy use case that isn’t discussed much is bulk update.
updateMany
doesn’t let us set different values for each row we are updating. In SQL this is usually done with ainsert on duplicate...
where we purposely cause duplicates on every row.I would look at the knex conflict/merge API for inspiration.
Should be able to achieve the following in Pg, MySQL and SQLite with native
on conflict do
andon duplicate update
:API could look something like:
Although I personally think the update block is not needed and have never found a use for it in the current API (other than just to merge the fields). In the case that both
merge
andupdate
reference the same field, some precedence would need to be set.