Neon icon

Neon

Connect to Neon database and perform operations

Row → Execute Query

AI-generated

Summary

Execute a SQL query against a Neon database.

Inputs

  • schema — The schema to use.
  • table — The table to use.
  • query (required) — The SQL query to execute. Supports n8n expressions and $1, $2, ... for parameters.
  • options.queryMode — The way queries should be sent to the database (single, independently, transaction).
  • options.queryParameters — Comma-separated list of query parameter values referenced as $1, $2, etc.
  • options.cascade — Whether to drop all objects that depend on the table when deleting.
  • options.delayClosingIdleConnection — Number of seconds to wait before idle connection would be eligible for closing.
  • options.outputColumns — Choose output column names or IDs, using expressions if needed.
  • options.outputLargeFormatNumberAs — How to handle PostgreSQL BIGINT/NUMERIC types that exceed JavaScript limits.
  • options.replaceEmptyStrings — Whether to replace empty strings with NULL in input.
  • options.skipOnConflict — Whether to skip the row and not throw error on unique constraint violation.

Output shape

An array of rows returned by the query

If no outputColumns are specified, all columns are returned; errors raise a NodeOperationError.

Examples

Example 1: Select rows from a users table

Schema: public, Table: users, Query: SELECT id, name FROM users, Output Columns: id,name

Example 2: Insert data with conflict handling

Schema: public, Table: users, Query: INSERT INTO users (id,name) VALUES ($1,$2), Skip on Conflict: true

Example 3: Run multiple queries in a transaction

Query Mode: transaction, Query: SELECT * FROM products; UPDATE inventory SET qty = qty - 1 WHERE product_id=$1, Query Parameters: value1,value2

Discussion