Andrei Dumitru
Andrei Dumitru

Reputation: 3

Apache NiFi dynamic atributes for PutDatabaseRecord Processor

I have this flow in NiFi:

GetFile -> ConvertExcelToCSVProcessor -> ReplaceText -> PutDatabaseRecord.

It's working ok but I want to set "table name" property of

PutDatabaseRecord

based on csv file name (and if it's posible to customize it). I can't find anything in docs or web. Thanks!

Upvotes: 0

Views: 429

Answers (1)

daggett
daggett

Reputation: 28564

According to documentation, the parameter table name of the PutDatabaseRecord processor supports nifi expression language.

So, if the attribute filename of your flow file contains value MyTableName.csv you could use expression with regular expression to convert file name to table name in PutDatabaseRecord processor like this:

Table Name = ${filename:replaceAll('\\..*','')}

Upvotes: 1

Related Questions