module concurrent
Utilities for concurrent query execution with the DataStax Node.js Driver.
Utilities for concurrent query execution with the DataStax Node.js Driver.
Client
client, String
or Array
<{query, params}> query, Array
<Array
>, Stream
or Object
parameters, [Object
options])
Executes multiple queries concurrently at the defined concurrency level.
const query = 'INSERT INTO table1 (id, value) VALUES (?, ?)';
const parameters = [[1, 'a'], [2, 'b'], [3, 'c'], ]; // ...
const result = await executeConcurrent(client, query, parameters);
const stream = csvStream.pipe(transformLineToArrayStream);
const result = await executeConcurrent(client, query, stream);
const queryAndParameters = [
{ query: 'INSERT INTO videos (id, name, user_id) VALUES (?, ?, ?)',
params: [ id, name, userId ] },
{ query: 'INSERT INTO user_videos (user_id, id, name) VALUES (?, ?, ?)',
params: [ userId, id, name ] },
{ query: 'INSERT INTO latest_videos (id, name, user_id) VALUES (?, ?, ?)',
params: [ id, name, userId ] },
];
const result = await executeConcurrent(client, queryAndParameters);
Name | Type | Description |
---|---|---|
client | Client |
The |
query |
String or Array <{query, params}>
|
The query to execute per each parameter item. |
parameters |
Array <Array >, Stream or Object
|
An |
options optional | Object |
The execution options. |
options.executionProfile optional | String |
The execution profile to be used. |
options.concurrencyLevel optional | Number |
The concurrency level to determine the maximum amount of in-flight operations at any given time (default:100 ) |
options.raiseOnFirstError optional | Boolean |
Determines whether execution should stop after the first failed execution and the corresponding exception will be raised. (default:true ) |
options.collectResults optional | Boolean |
Determines whether each individual
false ) |
options.maxErrors optional | Number |
The maximum amount of errors to be collected before ignoring the rest of the error results. (default:100 ) |
Type | Description |
---|---|
Promise <ResultSetGroup >
|
A |