Created 02-02-2022 01:56 AM
Hello,
I am still a newbie in NiFi.
I Json flowfile that i want to persist in a database using ConvertJsontoSql & PutSql.
I have no problem if the names of keys in Json flowfile match with the columns name in the database.
But if the keys names are different from column names whilst referring to same thing.
For example:
Flowfile attribute: surname
Database column: lastname
I have no access to alter database. And i have tried JoltTransform which didn't work.
Please, how do i map json keys to columns names , even if the key names change it would still point to the same column in the database.
Thank you.
Created 02-02-2022 10:24 PM
For the JoltTransformation what people will need to see is the data being fed to it in the context of the flow, i.e., the queue prior to the transform contains what? If it's an array then you're transform is wrong but seeing that will hopefully allow people to solve your issue.
Regards,
Ron.
Created 02-06-2022 04:18 PM
You can try the following Jolt spec in a JoltTransformRecord processor to change the name of one or more columns:
Jolt Transformation DSL: Chain
Jolt Specification:
[
{
"operation": "shift",
"spec": {
"*": "&",
"surname": "lastname"
}
},
{
"operation": "remove",
"spec": {
"surname": ""
}
}
]