Support Questions

Find answers, ask questions, and share your expertise

Insert else update into hive table using NIFI

avatar

I am planning to read from db2 database and do a update else insert into a hive table. what processors should be used to achive this.

1 ACCEPTED SOLUTION

avatar
Guru

Hi @Sateesh Mandumula

For reading from the RDBMS, you can use processors like QueryDatabaseTable or ExecuteSQL. Hive now supports Merge which should cover your update else insert requirement, you can try using a PutHiveQL and seeing if you can issue the merge command using that. Here are some relevant links to the documentation that should help:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.3.0/org.apache...

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.3.0/org.apache...

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Merge

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-hive-nar/1.3.0/org.apache.nif...

View solution in original post

1 REPLY 1

avatar
Guru

Hi @Sateesh Mandumula

For reading from the RDBMS, you can use processors like QueryDatabaseTable or ExecuteSQL. Hive now supports Merge which should cover your update else insert requirement, you can try using a PutHiveQL and seeing if you can issue the merge command using that. Here are some relevant links to the documentation that should help:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.3.0/org.apache...

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.3.0/org.apache...

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Merge

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-hive-nar/1.3.0/org.apache.nif...