How to bulk insert from JS client?
See original GitHub issueToday the SurrealQL query language supports multiple-insert in a single statement as follows:
INSERT INTO company (name, founded) VALUES ('Acme Inc.', '1967-05-03'), ('Apple Inc.', '1976-04-01');
However, the JS client currently only provides db.create()
, which supports a single record at at a time.
What is the best way to bulk insert when using the JS (Deno / Node / Bun) client? Should one use the raw db.query()
command? If so, what is the expected syntax?
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How do I do a bulk insert in mySQL using node.js
Bulk inserts are possible by using nested array, see the github page. Nested arrays are turned into grouped lists (for bulk inserts), e.g....
Read more >How to Work With Bulk Insert Operation - RavenDB
The bulk insert operation is broken into batches, each batch is treated in its own transaction so the whole operation isn't treated under...
Read more >Optimizing Conditional Bulk Insert in Node.js + PostgreSQL
In this article, I'm going to compare three approaches of conditional bulk insert for Node.JS and PostgreSQL:.
Read more >Insert Multiple Documents — Node.js - MongoDB
You can insert multiple documents using the collection.insertMany() method. The insertMany() takes an array of documents to insert into the specified ...
Read more >Safely Inserting Bulk Data to Mysql with NodeJs - Medium
1. Bulk insert ... To make this single query all we need is an array of arrays that will have your entries. ......
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 FreeTop 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
Top GitHub Comments
This type of thinking is a very slippery slope. Security should never be assumed (especially with one of the top 10 web application security risks). I advocate for adding an explicit bulk insert option to the JS client so that string interpolation is not required.
@fritzblue +1 but actually bulk loading feature for ALL client APIs is currently missing. Would be great to have a load CSV/JSON/TEXT/BINARY option like all other RDBMS and many graph dbs too (Neo4j, Janus, etc.).
Would you consider broadening the title of this issue to just be “How to bulk insert from client”?
EDIT: Whoops just noticed this is the js repo… sorry and thanks @mathe42 for pointing that out