Apache Nifi的QueryDatabaseTableRecord不会自动对数据进行排序。但是,可以通过修改查询语句来实现对结果进行排序。
以下是一个示例代码,展示了如何在QueryDatabaseTableRecord中添加排序功能:
QueryDatabaseTableRecordWithSort
6a367e2c-3b62-4d8e-8e5a-854b2d42083c
QueryDatabaseTableRecordWithSort
16a2d9c5-5c1b-4e16-81f6-8e7d4291a291
694b2e1e-5c10-49c3-ac6b-8c840a56c2b2
1
1 GB
10000
0 sec
FIFO
FlowFiles are prioritized in the order in which they were received
16a2d9c5-5c1b-4e16-81f6-8e7d4291a291
QueryDatabaseTableRecordWithSort
org.apache.nifi.processors.standard.QueryDatabaseTableRecord
1
0 sec
30 sec
1 sec
WARN
0
failure
unmatched
Database Connection Pooling Service
The Controller Service that is used to obtain a connection to the database
false
Table Name
The name of the database table to be queried
false
Max Rows Per Flow File
1000
The maximum number of result rows to be included in a single FlowFile
false
Maximum Value Columns
id
A comma-separated list of column names that uniquely identify a row. These columns are used to determine the maximum value of the column specified in the "Column to Track" property.
false
Column to Track
id
The column whose value will be used to track the maximum value. This value should be numeric or a timestamp
false
Sort Columns
id ASC
A comma-separated list of columns to sort by. Each column can be followed by "ASC" or "DESC" to specify ascending or descending order respectively. Example: "column1 ASC, column2 DESC"
false
Query
SELECT * FROM table_name
The SQL query to execute. May use ${} to escape parameter values.