Filter to SQL icon

Filter to SQL

Преобразует перечень условий QueryBuilder (массив { field, operator, value, date_limit? }) в готовый блок WHERE с уже подставленными значениями — одна SQL-строка. Операторы: ==, !=, >, <, between, in. Подставляйте в запрос как {{ $json.whereClause }}, Query Parameters не нужны.

Filter to SQL

AI-generated

Summary

Builds a SQL WHERE fragment from the supplied JSON filter conditions, with values escaped and embedded in the SQL string. Use the returned whereClause in a downstream query, for example as {{ $json.whereClause }}.

Inputs

  • Filter (JSON) (`filterJson`) — A JSON array of conditions with field, operator, and value. Operators are ==, !=, >, <, between (two-element value array), and in (value array). Conditions are joined with AND. An optional date_limit adds an inclusive date range, using mode (relative, after, before, or range), optional days/hours or start/end, and optional column; the column defaults to field. Safe SQL identifier names are required for fields. Invalid JSON, non-array input, and unrecognized rows are ignored; the default is []`.

Output shape

A single n8n item containing whereClause, a SQL string; it is empty when no valid conditions produce clauses.

The operation returns no separate query-parameters array. Values are embedded as escaped SQL literals, with dates reduced to YYYY-MM-DD. Date limits use the current time when bounds are omitted.

Links

Discussion