CloudBeaver icon

CloudBeaver

Interact with databases via CloudBeaver: execute SQL queries, select, insert, update, and delete rows

Execute SQL Query

AI-generated

Summary

Execute a raw SQL query on a database connection managed by CloudBeaver, optionally applying additional filtering, ordering, and pagination parameters.

Inputs

  • connectionId (required) — The database connection ID from CloudBeaver, needed to identify which database to query.
  • defaultDatabase — The default database or catalog to use for the query; leave empty to use the connection's default.
  • query (required) — The raw SQL query string to execute.
  • limit — Maximum number of results to return; must be a positive integer (default 50).
  • offset — Number of results to skip before returning rows; must be a non-negative integer (default 0).
  • orderBy — Additional ORDER BY clause applied on top of the SQL query to sort results, e.g. 'name ASC, created_at DESC'.
  • where — Additional WHERE clause applied on top of the SQL query to filter results, e.g. "age > 18 AND status = 'active'".
  • options.queryTimeout — Maximum number of seconds to wait for the query to complete before timing out (default 60).
  • options.replaceEmptyStrings — Whether to replace any empty string values in the query results with NULL values (default false).

Output shape

a list of items representing rows returned by the SQL query, each item containing a JSON object with columns as keys and result values as properties

The operation returns zero or more result rows as output items, paged according to limit and offset. The where and orderBy parameters are applied on top of the given SQL query. Empty strings in results are optionally replaced with null based on the input option. Errors during execution may throw or optionally output items with error details if 'Continue On Fail' mode is enabled.

Examples

Example 1: Execute a SQL query to retrieve up to 50 active users ordered by creation date descending from a PostgreSQL database connection

Set connectionId to the CloudBeaver connection ID, specify the raw SQL in query (e.g. SELECT * FROM users), set where to status = 'active', set orderBy to created_at DESC, and use default limit and offset. Optionally set defaultDatabase if needed.
The node outputs the matching user rows as JSON items.

Links

Discussion