PutSQL 2025.10.2.19

Bundle

org.apache.nifi | nifi-standard-nar

Beschreibung

Executes a SQL UPDATE or INSERT command. The content of an incoming FlowFile is expected to be the SQL command to execute. The SQL command may use the ? to escape parameters. In this case, the parameters to use must exist as FlowFile attributes with the naming convention sql.args. N.type and sql.args. N.value, where N is a positive integer. The sql.args. N.type is expected to be a number indicating the JDBC Type. The content of the FlowFile is expected to be in UTF-8 format.

Tags

database, insert, put, rdbms, relational, sql, update

Eingabeanforderung

REQUIRED

Unterstützt sensible dynamische Eigenschaften

false

Eigenschaften

Eigenschaft

Beschreibung

Batch Size

Die bevorzugte Anzahl von FlowFiles, die in einer einzigen Transaktion in die Datenbank eingegeben werden soll

JDBC Connection Pool

Gibt den JDBC-Verbindungspool an, der verwendet werden soll, um die JSON-Meldung in eine SQL-Anweisung umzuwandeln. Der Verbindungspool ist notwendig, um die entsprechenden Datenbankspaltentypen zu bestimmen.

Obtain Generated Keys

Bei „true“ wird jeder Schlüssel, der automatisch von der Datenbank generiert wird, mithilfe des Attributs „sql.generate.key” zu dem FlowFile hinzugefügt, das ihn generiert hat. Dies kann zu einer etwas langsameren Leistung führen und wird nicht von allen Datenbanken unterstützt.

Support Fragmented Transactions

If true, when a FlowFile is consumed by this Processor, the Processor will first check the fragment.identifier and fragment.count attributes of that FlowFile. If the fragment.count value is greater than 1, the Processor will not process any FlowFile with that fragment.identifier until all are available; at that point, it will process all FlowFiles with that fragment.identifier as a single transaction, in the order specified by the FlowFiles ‚fragment.index attributes. This Provides atomicity of those SQL statements. Once any statement of this transaction throws exception when executing, this transaction will be rolled back. When transaction rollback happened, none of these FlowFiles would be routed to’success ‚. If the <Rollback On Failure> is set true, these FlowFiles will stay in the input relationship. When the <Rollback On Failure> is set false,, if any of these FlowFiles will be routed to‘ retry ‚, all of these FlowFiles will be routed to‘ retry ‚.Otherwise, they will be routed to‘ failure‘. If this value is false, these attributes will be ignored and the updates will occur independent of one another.

Transaction Timeout

Wenn die Eigenschaft <Support Fragmented Transactions> auf „true“ gesetzt ist, gibt sie an, wie lange gewartet werden soll, bis alle FlowFiles für ein bestimmtes fragment.identifier-Attribut eingetroffen sind, bevor einfach alle FlowFiles mit diesem Bezeichner an die Beziehung „failure“ übertragen werden.

database-session-autocommit

Der Auto-Commit-Modus, der für die verwendete Datenbankverbindung eingestellt werden soll. Bei „false“ werden die Operationen explizit übertragen oder zurückgesetzt (je nach Erfolg Misserfolg). Bei „true“ übernimmt der Treiber/die Datenbank die Übertragung/Rücksetzung.

putsql-sql-statement

Die auszuführende SQL-Anweisung. Die Anweisung kann leer sein, einen konstanten Wert enthalten oder mithilfe der Expression Language aus Attributen gebildet werden. Wenn diese Eigenschaft angegeben ist, wird sie unabhängig vom Inhalt des eingehenden FlowFiles verwendet. Wenn diese Eigenschaft leer ist, wird erwartet, dass der Inhalt des eingehenden FlowFile eine gültige SQL-Anweisung enthält, die vom Prozessor an die Datenbank ausgegeben werden soll.

rollback-on-failure

Specify how to handle error. By default (false), if an error occurs while processing a FlowFile, the FlowFile will be routed to ‚failure‘ or ‚retry‘ relationship based on error type, and processor can continue with next FlowFile. Instead, you may want to rollback currently processed FlowFiles and stop further processing immediately. In that case, you can do so by enabling this ‚Rollback On Failure‘ property. If enabled, failed FlowFiles will stay in the input relationship without penalizing it and being processed repeatedly until it gets processed successfully or removed by other means. It is important to set adequate ‚Yield Duration‘ to avoid retrying too frequently.

Beziehungen

Name

Beschreibung

failure

Ein FlowFile wird an diese Beziehung weitergeleitet, wenn die Datenbank nicht aktualisiert werden kann und ein erneuter Versuch der Operation ebenfalls fehlschlägt, z. B. bei einer ungültigen Abfrage oder einer Verletzung der Integritätseinschränkung.

retry

Ein FlowFile wird an diese Beziehung weitergeleitet, wenn die Datenbank nicht aktualisiert werden kann, die Operation aber bei einem erneuten Versuch erfolgreich sein kann.

success

Ein FlowFile wird an diese Beziehung weitergeleitet, nachdem die Datenbank erfolgreich aktualisiert wurde.

Schreibt Attribute

Name

Beschreibung

sql.generated.key

Wenn die Datenbank einen Schlüssel für eine INSERT-Anweisung generiert hat und die Eigenschaft „Obtain Generated Keys“ (Generierte Schlüssel abrufen) auf „true“ gesetzt ist, wird dieses Attribut hinzugefügt, um den generierten Schlüssel anzugeben, falls möglich. Dieses Feature wird nicht von allen Datenbankanbietern unterstützt.