Member since
06-26-2015
511
Posts
137
Kudos Received
114
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1352 | 09-20-2022 03:33 PM | |
3942 | 09-19-2022 04:47 PM | |
2304 | 09-11-2022 05:01 PM | |
2408 | 09-06-2022 02:23 PM | |
3781 | 09-06-2022 04:30 AM |
09-06-2022
02:23 PM
@rafy You shouldn't need to extract the content as an attribute. Instead, use ReplaceText to replace the contents of the flowfile with the SQL template, like this: INSERT INTO my_table (xml_col) VALUES ('$1') Where $1 is a reference to the default regex capture group that captures the entire content. In reality, it requires a bit more labour, since you have to escape the single quotes in the XML first. Cheers, André
... View more
09-06-2022
02:17 PM
@VenkatG , What are you trying to use this resulting JSON for? That seems a bit odd of a format to me. Nevertheless, here's a JOLT to achieve that (or close): [
{
"operation": "default",
"spec": {
"__timestamp": "${now()}"
}
},
{
"operation": "shift",
"spec": {
"custId": "Rows[0].values[0]",
"name": "Rows[0].values[1]",
"Address2": "Rows[0].values[2]",
"Address1": "Rows[0].values[3]",
"zip": "Rows[0].values[4]",
"__timestamp": "Rows[0].values[5]"
}
},
{
"operation": "default",
"spec": {
"operationType": "Insert",
"Source": "Dev"
}
}
] Cheers, André
... View more
09-06-2022
04:30 AM
1 Kudo
Hi, @code , I don't think this is actually possible. Even if there was a way to enter a literal value of NULL for the lookup value, the controller service is probably comparing the lookup value with an "equals" operation (e.g. mytable.mykey = lookup_value) and in relational databases the comparison NULL = NULL is always evaluated to FALSE. (the only way to compare values with a NULL is to use the operator IS). What you can try to do is to create a view on top of that table that converts NULLs to some string that you can use to compare to lookup values in NiFi. Then you can use the view name in the controller service configuration instead of the table name. For example: CREATE VIEW v_mytable AS
SELECT
NVL(mykey, '<NULL>') as key_without_nulls, *
FROM mytable Be aware of potential performance implications of this, since this could prevent existing table indexes from being used for lookups. Cheers, André
... View more
09-06-2022
04:16 AM
@Markyd , Functions used in Hive queries are usually passed to the Hive service as is. I don't think the ODBC driver does any particular processing or validation of those functions. At the end of the day it's a matter of whether the Hive version you're using supports that function or not, and this depends on the Hive version being used, not the driver version. Here you can see a comprehensive list of Hive functions and the associated Hive version where they were introduced: https://cwiki.apache.org/confluence/display/hive/languagemanual+udf Which version of Hive are you using? Are you using the Cloudera ODBC Drivers for Hive? Which version? Cheers, André
... View more
09-05-2022
03:54 PM
@Ahmed_Abuhaimed , Have you looked into change data capture functionality for Hana? https://help.sap.com/docs/SAP_DATA_INTELLIGENCE/1c1341f6911f4da5a35b191b40b426c8/023c75aedfdd4646934f2d9ccde5660a.html Cheers, André
... View more
09-05-2022
03:48 PM
@samrathal , Is seems that "subtract" only works for integers and your value is a long. The longSubtract function only works if longs are passed as parameters and I don't know if there's a way to specify a long literal in Jolt (I tried 60L but that doesn't work). The following does a little bit more work but also achieves what you want: [
{
"operation": "modify-overwrite-beta",
"spec": {
"currenttime": "=toLong(${now():toNumber()})",
"minute": "=toLong(60)"
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"timeOneMinu": "=longSubtract(@(1,currenttime), @(1,minute))"
}
},
{
"operation": "remove",
"spec": {
"minute": ""
}
}
] Output: {
"currenttime": 1662417935173,
"timeOneMinu": 1662417935113
} Cheers, André
... View more
09-05-2022
03:09 PM
@samrathal , What about this: [
{
"operation": "default",
"spec": {
"currenttime": "${now():toNumber()}",
"timeOneMinu": "${now():toNumber():minus(60)}"
}
}
]
... View more
09-05-2022
05:37 AM
@samrathal , Doesn't your JOLT spec solve your own problem? Cheers, André
... View more
09-04-2022
10:21 PM
@syntax_ , It seems to me that your source Kafka is a Confluent Kafka cluster and the producer uses schema registry to source the schema from it. In this case, the KafkaAvroSerializer prepends 5 bytes to every message produced to indicate the id of the schema that was used (in you case, schema id 34). If you try to read this message as a pure Avro payload the deserialization will fail because those 5 bytes are not part of the Avro payload. So, the best way to handle this in NiFi is to also use Schema Registry to deserialize Avro messages. With this, NiFi will get the schema ID from the message 5-byte prefix, use that ID to retrieve the correct schema from Schema Registry and then correctly deserialize the Avro payload. Considering that my guess is correct and you're using a Confluent Schema Registry, you should create a new ConfluentSchemaRegistry controller service and configure it with the details of your Schema Registry. Once this is done, edit the configuration of the Avro Reader controller service and set the following: After you do this, your flow should be able to correctly process the messages that you're reading from Kafka. I read the binary message that you send me with NiFi and loaded the schema in my local schema registry service (making sure it got assigned the right ID 34), and I was able to successfully convert the message from Avro to JSON using a ConvertRecord processor: Cheers, André
... View more