UpdateDatabaseTable 2025.10.2.19

捆绑包

org.apache.nifi | nifi-standard-nar

描述

该处理器使用 JDBC 连接和传入记录来生成支持传入记录所需的任何数据库表更改。它预期采用“扁平”记录布局,这意味着没有任何顶级记录字段包含旨在成为列本身的嵌套字段。

标签

alter、database、jdbc、metadata、table、update

输入要求

REQUIRED

支持敏感的动态属性

false

属性

属性

描述

列名转换模式

列名将使用此正则表达式实现标准化

列名转换策略

用于标准化表列名的策略。无论策略如何,列名都将采用大写形式,以执行不区分大小写的匹配

数据库方言服务

数据库方言服务,用于生成特定于某服务或供应商的语句。

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.

record-reader

用于读取传入 FlowFile 的服务。读取器仅用于确定记录架构,不会处理实际记录。

updatedatabasetable-catalog-name

语句应更新的目录的名称。这可能不适用于您正在更新的数据库。在此类情况下,应将该字段留空。请注意,如果设置了该属性并且数据库区分大小写,则目录名称必须与数据库的目录名称完全匹配。

updatedatabasetable-create-table

指定在目标表不存在时,如何对其进行处理(例如,创建、失效)。

updatedatabasetable-dbcp-service

用于获取数据库连接的控制器服务

updatedatabasetable-primary-keys

逗号分隔式记录字段名称列表,用于唯一标识数据库中的一行。此属性仅在需要创建指定表时使用,在此类情况下,主键字段将用于指定新创建的表的主键。IMPORTANT:主键字段必须与记录字段名称完全匹配,除非“引用列标识符”为 false 并且数据库允许不区分大小写的列名。实际上,最好指定与记录字段名称完全匹配的主键字段,这些字段将成为所创建表中的列名。

updatedatabasetable-query-timeout

设置驱动程序将在多少秒内等待查询执行。如值为 0,则表示无超时。NOTE:驱动程序可能不支持非零值。

updatedatabasetable-quoted-column-identifiers

启用此选项将导致所有列名都被置于引号之间,从而允许您在表中使用保留字作为列名和/或强制要求记录字段名称与列名完全匹配。

updatedatabasetable-quoted-table-identifiers

启用此选项将导致表名被置于引号之间,以支持在表名中使用特殊字符和/或强制要求表名称属性的值与目标表名完全匹配。

updatedatabasetable-record-writer

Specifies the Controller Service to use for writing results to a FlowFile. The Record Writer should use Inherit Schema to emulate the inferred schema behavior, i.e. an explicit schema need not be defined in the writer, and will be supplied by the same logic used to infer the schema from the column types. If Create Table Strategy is set 'Create If Not Exists', the Record Writer 's output format must match the Record Reader's format in order for the data to be placed in the created table location. Note that this property is only used if 'Update Field Names' is set to true and the field names do not all match the column names exactly. If no update is needed for any field names (or 'Update Field Names' is false), the Record Writer is not used and instead the input FlowFile is routed to success or failure without modification.

updatedatabasetable-schema-name

表所属的数据库架构的名称。这可能不适用于您正在更新的数据库。在此类情况下,应将该字段留空。请注意,如果设置了该属性并且数据库区分大小写,则架构名称必须与数据库的架构名称完全匹配。

updatedatabasetable-table-name

要更新的数据库表的名称。如果该表不存在,则将创建该表或引发错误,具体取决于创建表属性的值。

updatedatabasetable-translate-field-names

如果为 true,处理器将尝试将字段名称转换为指定表的相应列名,以确定该字段名是否以列的形式存在于目标表中。NOTE:如果目标表不存在且需要创建,则忽略此属性,并按原样使用字段名称。如果为 false,则字段名称必须与列名称完全匹配,否则可能找不到该列,并且会报告有关该列已经存在的错误。

updatedatabasetable-update-field-names

This property indicates whether to update the output schema such that the field names are set to the exact column names from the specified table. This should be used if the incoming record field names may not match the table 's column names in terms of upper- and lower-case. For example, this property should be set to true if the output FlowFile is destined for Oracle e.g., which expects the field names to match the column names exactly. NOTE: The value of the'Translate Field Names' property is ignored when updating field names; instead they are updated to match the column name as returned by the database.

关系

名称

描述

failure

包含无法传输到数据库的记录的 FlowFile 将路由到此关系。

success

包含已成功传输到数据库的记录的 FlowFile 将路由到此关系。

写入属性

名称

描述

output.table

此属性写入到路由到“success”和“failure”关系的 FlowFile,并包含目标表名称。

output.path

此属性写入路由到“success”和“failure”关系的 FlowFile,并包含文件系统上表的路径(如果表已分区,则为分区位置)。

mime.type

仅当指定了记录写入器且更新字段名称为“true”时,才将 mime.type 属性设置为记录写入器指定的 MIME 类型。

record.count

仅当指定了记录写入器且更新字段名称为“true”时,才设置 FlowFile 中的记录数量。

语言: 中文