Icon

kn_​example_​hive_​missing_​table_​switch

Hive - how to handle missing tables in Hive?

use try and catch for generic ports. The existing table will be at the resulting port

Try some generic SQL operation on your Hive (or Impala) environment. If one fails you could populate a Flow variable with some information (eg. the surviving table)

Another possibility would be to try some combination with the "Active Branch Inverter"
https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.base.node.flowcontrol.trycatch.inverter.ActiveBranchInverterNodeFactory



Hive - how to handle missing tables in Hive? use try and catch for generic ports. The existing table will be at the resulting port Try some generic SQL operation on your Hive environment. If one fails you could populate a Flow variable with some information (eg. the surviving table) KNIME, Databases and SQLhttps://medium.com/p/273e27c9702a create dummy datatest1Cluster_Membershipload datainto hivetabletest1Start Trytry to select selectdefault.test1Start Trythe tablethat exists is at the outputporttry to select selectdefault.test2(wil fail)try to create a dummy tablefrom test1try to create a dummy tablefrom test2(will fail)v_use_this_tablev_use_this_tabletry to select select the existing table test1 or test2create a newtable test_newwith column indicating thetry to select selectdefault.test_newsee resultssee resultssee resultstest2=> deletes the wholelocal big data folder/big_dataif you encouter any problems, closeKNIME and delete all data from the folder/big_data/1st cretae (empty)hive tabletest1with the structureget the resultif both succeedthe first input willbe usedData Generator DB Table Remover Column Rename DB Loader Try (VariablePorts) DB Table Selector Try (VariablePorts) Catch Errors(Generic Ports) DB Table Selector DB SQL Executor DB SQL Executor Java EditVariable (simple) Java EditVariable (simple) DB Table Selector DB SQL Executor DB Table Selector DB Reader DB Reader DB Reader DB Table Remover local big datacontext create DB Table Creator CASE Switch End Hive - how to handle missing tables in Hive? use try and catch for generic ports. The existing table will be at the resulting port Try some generic SQL operation on your Hive environment. If one fails you could populate a Flow variable with some information (eg. the surviving table) KNIME, Databases and SQLhttps://medium.com/p/273e27c9702a create dummy datatest1Cluster_Membershipload datainto hivetabletest1Start Trytry to select selectdefault.test1Start Trythe tablethat exists is at the outputporttry to select selectdefault.test2(wil fail)try to create a dummy tablefrom test1try to create a dummy tablefrom test2(will fail)v_use_this_tablev_use_this_tabletry to select select the existing table test1 or test2create a newtable test_newwith column indicating thetry to select selectdefault.test_newsee resultssee resultssee resultstest2=> deletes the wholelocal big data folder/big_dataif you encouter any problems, closeKNIME and delete all data from the folder/big_data/1st cretae (empty)hive tabletest1with the structureget the resultif both succeedthe first input willbe usedData Generator DB Table Remover Column Rename DB Loader Try (VariablePorts) DB Table Selector Try (VariablePorts) Catch Errors(Generic Ports) DB Table Selector DB SQL Executor DB SQL Executor Java EditVariable (simple) Java EditVariable (simple) DB Table Selector DB SQL Executor DB Table Selector DB Reader DB Reader DB Reader DB Table Remover local big datacontext create DB Table Creator CASE Switch End

Nodes

Extensions

Links