PutDatabaseRecord 2025.10.2.19

バンドル

org.apache.nifi | nifi-standard-nar

説明

The PutDatabaseRecord processor uses a specified RecordReader to input (possibly multiple) records from an incoming flow file. These records are translated to SQL statements and executed as a single transaction. If any errors occur, the flow file is routed to failure or retry, and if the records are transmitted successfully, the incoming flow file is routed to success. The type of statement executed by the processor is specified via the Statement Type property, which accepts some hard-coded values such as INSERT, UPDATE, and DELETE, as well as 'Use statement.type Attribute', which causes the processor to get the statement type from a flow file attribute. IMPORTANT: If the Statement Type is UPDATE, then the incoming records must not alter the value(s) of the primary keys (or user-specified Update Keys). If such records are encountered, the UPDATE statement issued to the database may do nothing (if no existing records with the new primary key values are found), or could inadvertently corrupt the existing data (by changing records for which the new values of the primary keys exist).

タグ

データベース、削除、挿入、jdbc、プット、記録、SQL、更新

入力要件

REQUIRED

機密動的プロパティをサポート

false

プロパティ

プロパティ

説明

列名変換パターン

列名はこの正規表現で正規化されます。

列名 翻訳ストラテジー

テーブルの列名を正規化するために使用されるストラテジー。大文字と小文字を区別しないマッチングを行うため、ストラテジーに関係なく列名は大文字になります。

データ記録パス

指定された場合、このプロパティは、各入力記録に対して評価される RecordPath を示し、 RecordPath を評価した結果の記録は、全入力記録を送信する代わりにデータベースに送信されます。指定しない場合、受信記録全体がデータベースに公開されます。

データベース方言サービス

特定のサービスやベンダーに特化したステートメントを生成するためのデータベース方言サービス。

キー削除

DELETE ステートメントで使用する、データベース内の行を一意に識別する列名のカンマ区切りリスト。ステートメント・タイプが DELETE で、このプロパティがセットされていない場合は、テーブルの列が使用されます。このプロパティは、ステートメントタイプが DELETE でない場合、無視されます。

ステートメントタイプ 記録パス

ステートメントタイプを決定するために、各記録に対して評価する RecordPath を指定します。RecordPath は、 INSERT、 UPDATE、 UPSERT、 DELETE のいずれかに相当します。(Debeziumスタイルの演算子タイプもサポートされています。 INSERT 用の「r」と「c」、 UPDATE 用の「u」、 DELETE 用の「d」)

database-session-autocommit

使用するデータベース接続にセットする自動コミットモード。false をセットすると、演算子は明示的にコミットまたはロールバックされます (それぞれ成功または失敗に基づいて)。trueにセットすると、ドライバー/データベースは自動的にコミット/ロールバックを処理します。

db-type

Database Type for generating statements specific to a particular service or vendor. The Generic Type supports most cases but selecting a specific type enables optimal processing or additional features.

put-db-record-allow-multiple-statements

ステートメント・タイプが 'SQL' (statement.type属性でセット)の場合、このフィールドはフィールド値をセミコロンで分割し、各ステートメントを個別に実行するかどうかを示します。ステートメントがエラーを起こした場合、ステートメントのセット全体がロールバックされます。ステートメント・タイプが 'SQL' でない場合、このフィールドは無視されます。

put-db-record-binary-format

文字列値をバイナリにデコードする際に適用する形式。

put-db-record-catalog-name

The name of the database (or the name of the catalog, depending on the destination system) that the statement should update. This may not apply for the database that you are updating. In this case, leave the field empty. Note that if the property is set and the database is case-sensitive, the catalog name must match the database's catalog name exactly.

put-db-record-dcbp-service

記録を送信するためのデータベースへの接続を取得するために使用されるController Service。

put-db-record-field-containing-sql

ステートメント・タイプが 'SQL' (statement.type属性でセット) の場合、このフィールドは記録のどのフィールドに実行する SQL ステートメントが含まれているかを示します。フィールドの値は、単一の SQL ステートメントでなければなりません。ステートメント・タイプが 'SQL' でない場合、このフィールドは無視されます。

put-db-record-max-batch-size

データベースに送信する各バッチに含めるステートメントの最大数を指定します。ゼロはバッチサイズが制限されていないことを意味し、すべてのステートメントが1つのバッチに入れられるため、非常に多くのステートメントでメモリ使用量の問題が発生する可能性があります。

put-db-record-query-timeout

実行中の SQL ステートメントに許される最大時間。ゼロは制限がないことを意味します。1秒未満の最大時間はゼロに等しくなります。

put-db-record-quoted-identifiers

このオプションを有効にすると、すべての列名が引用符で囲まれるようになり、予約語をテーブルの列名として使用できるようになります。

put-db-record-quoted-table-identifiers

このオプションを有効にすると、テーブル名が引用符で囲まれ、テーブル名での特殊文字の使用に対応します。

put-db-record-record-reader

受信データのパースやデータのスキーマの決定に使用する Controller Service を指定します。

put-db-record-schema-name

テーブルが属するスキーマの名前。更新対象のデータベースには適用されない場合があります。この場合、フィールドは空欄のままにしてください。このプロパティがセットされていてデータベースが大文字と小文字を区別する場合、スキーマ名はデータベースのスキーマ名と正確に一致しなければならないことに注意してください。

put-db-record-statement-type

Specifies the type of SQL Statement to generate. Please refer to the database documentation for a description of the behavior of each operation. Please note that some Database Types may not support certain Statement Types. If 'Use statement.type Attribute' is chosen, then the value is taken from the statement.type attribute in the FlowFile. The 'Use statement.type Attribute' option is the only one that allows the 'SQL'statement type. If 'SQL' is specified, the value of the field specified by the 'Field Containing SQL' property is expected to be a valid SQL statement on the target database, and will be executed as-is.

put-db-record-table-name

ステートメントが影響するテーブルの名前。データベースが大文字と小文字を区別する場合、テーブル名はデータベースのテーブル名と正確に一致しなければならないことに注意してください。

put-db-record-translate-field-names

true の場合、プロセッサーはフィールド名を指定されたテーブルの適切な列名に変換しようとします。falseの場合、フィールド名は列名と完全に一致しなければなりません。

put-db-record-unmatched-column-behavior

受信レコードがデータベーステーブルのすべての列のフィールドマッピングを持っていない場合、このプロパティはその状況を処理する方法を指定します。

put-db-record-unmatched-field-behavior

受信レコードがデータベーステーブルの列のいずれにもマッピングされないフィールドを持つ場合、このプロパティはその状況をどのように処理するかを指定します。

put-db-record-update-keys

UPDATE ステートメントで使用する、データベース内の行を一意に識別する列名のカンマ区切りリスト。ステートメント・タイプが UPDATE で、このプロパティがセットされていない場合は、テーブルの主キーが使用されます。この大文字と小文字が存在しない場合、Unmatched Column Behaviour が FAIL にセットされていると、 SQL への変換は失敗します。このプロパティは、ステートメントタイプが INSERT である場合、無視されます。

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.

table-schema-cache-size

テーブルスキーマのキャッシュ数の指定

リレーションシップ

名前

説明

failure

FlowFile は、データベースを更新できず、無効なクエリや整合性制約違反など、操作を再試行しても失敗する場合は、このリレーションシップにルーティングされます。

retry

データベースを更新できない場合、 FlowFile はこのリレーションシップにルーティングされますが、再度操作を試みると成功する可能性があります。

success

SQL クエリ結果セットから FlowFile の作成に成功しました。

属性の書き込み

名前

説明

putdatabaserecord.error

処理中にエラーが発生した場合、フローファイルは失敗または再試行にルーティングされ、この属性にエラーの原因が入力されます。

ユースケース

データベースへの記録挿入