Plug Database icon

Plug Database

Run Plug Database commands over REST or Socket.

SQL → Execute Batch

AI-generated

Summary

Executes a batch of SQL commands through the Plug agent using REST or Socket. In Guided mode, provide a JSON array of commands; Advanced mode accepts a JSON-RPC command object for sql.executeBatch.

Inputs

  • Channel — Select REST or Socket transport; defaults to REST.
  • Input Mode — Guided mode builds the batch command from Batch Commands JSON. Advanced mode sends the supplied Raw JSON-RPC Command.
  • Batch Commands JSON (required) — In Guided mode, enter a JSON array of command objects. Each can include sql, params, and execution_order. The node validates named parameters and, by default, blocks UPDATE or DELETE statements without a WHERE clause before sending.
  • Raw JSON-RPC Command (required) — In Advanced mode, enter a JSON-RPC command object using the sql.executeBatch method. The resolved client token is injected where supported.
  • Additional Options — Guided-mode options include timeout, API version, command metadata, server timings, database target, idempotency key, transaction, maximum rows, and maximum parallel read-only batch items. Auto Performance Hints can suggest parallelism for batches it identifies as entirely read-only. Coalesce Input Items merges batch commands from incoming items into one call when enabled; the options must match across items.
  • Response Mode — Choose aggregated per-row items, one item containing rowCount and rows[], chunk items for supported Socket streams, or the normalized raw JSON-RPC envelope. Defaults to Aggregated JSON; with Auto Performance Hints enabled, it switches to a single item above 1000 returned rows.
  • Agent ID — Optional agent override; otherwise uses the credential default.
  • Client Token — Optional token override; otherwise uses the credential default.
  • Include Plug Metadata — Include the __plug metadata object in output; defaults to enabled.
  • Socket Options — Socket-specific buffering limits and stream pull window settings. Relay Fast Path is automatically omitted for sql.executeBatch; Socket Request Server Timings can request timing data when supported.

Output shape

One or more n8n items containing SQL result data, or a normalized JSON-RPC envelope in Raw JSON-RPC mode.

Output shape depends on Response Mode and the returned result. Aggregated JSON emits rows as items when possible and otherwise emits one JSON item; Aggregated Single Item emits one item with rowCount and rows[]. Chunk Items applies to supported Socket streams and other combinations fall back to aggregated output. Coalesce Input Items returns one output item for the merged call. __plug metadata is included by default when enabled.

Examples

Example 1: Run multiple queries in one Plug call

Choose Guided mode and enter an array of batch commands, optionally enabling a transaction or setting row and read-only parallelism limits.

Links

Discussion