Cloud Spanner nodes
kolban-google opened this issue · 2 comments
Cloud Spanner is a Google RDBMS that provides a global transactional database. This issue requests the creation of a new node or nodes for Cloud Spanner interaction.
At first blush, it appears that we want a node that will execute SQL statements supplied in string format. While the statements are supplied as String SQL, we need two configuration parameters at the node level. These appear to be:
- instance
- database
The high level access code looks to be:
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner({
projectId: projectId,
});
const instance = spanner.instance(instanceId);
const database = instance.database(databaseId);
const query = {
sql: 'SELECT SingerId, AlbumId, AlbumTitle FROM Albums',
};
const [rows] = await database.run(query);
The key to the story is the database.run()
function call documented here.
There are a rich set of additional options to Spanner but these are currently not in scope. Items in this list would include
- transactions
- streaming
- table creation
- meta data retrieval
- ... more
Node spec
Node name: Spanner Run
Configuration parameters:
- instance name - A single line text entry field.
- database name - A single line text entry field.
- SQL statements - A multi line text box.
Execution
When the node is reached, if a value is present in "SQL statements", the execution will use that value. If not present, the execution will use the value contained in msg.payload
. On completion, the output will be found in msg.payload
. The actual output will depend on the statements executes but for a query will be an array of records.
References
First implementation published in 0.0.24
A user tested and came back and said it worked. LGTM.