This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 0147afdde0 Example for Actions - check db connections & table exists
(#5918)
0147afdde0 is described below
commit 0147afdde0e9ce2afbde53f177f716fe5ec516b2
Author: Drazen Sander <[email protected]>
AuthorDate: Tue Oct 28 11:20:38 2025 +0100
Example for Actions - check db connections & table exists (#5918)
---
.../main/samples/actions/check-db-connections.hwf | 103 +++++++++++++
.../src/main/samples/actions/table-exists.hwf | 165 +++++++++++++++++++++
2 files changed, 268 insertions(+)
diff --git
a/plugins/actions/checkdbconnection/src/main/samples/actions/check-db-connections.hwf
b/plugins/actions/checkdbconnection/src/main/samples/actions/check-db-connections.hwf
new file mode 100644
index 0000000000..773517e074
--- /dev/null
+++
b/plugins/actions/checkdbconnection/src/main/samples/actions/check-db-connections.hwf
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+ <name>check-db-connections</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <workflow_version/>
+ <created_user>-</created_user>
+ <created_date>2025/10/27 17:29:38.495</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2025/10/27 17:29:38.495</modified_date>
+ <parameters>
+ </parameters>
+ <actions>
+ <action>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <DayOfMonth>1</DayOfMonth>
+ <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+ <hour>12</hour>
+ <intervalMinutes>60</intervalMinutes>
+ <intervalSeconds>0</intervalSeconds>
+ <minutes>0</minutes>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <weekDay>1</weekDay>
+ <parallel>N</parallel>
+ <xloc>80</xloc>
+ <yloc>128</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Check DB connections</name>
+ <description/>
+ <type>CHECK_DB_CONNECTIONS</type>
+ <attributes/>
+ <connections>
+ <connection>
+ <name>hop-samples</name>
+ <waitfor>100</waitfor>
+ <waittime>millisecond</waittime>
+ </connection>
+ </connections>
+ <parallel>N</parallel>
+ <xloc>256</xloc>
+ <yloc>128</yloc>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>Check DB connections</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ </hops>
+ <notepads>
+ <notepad>
+ <backgroundcolorblue>251</backgroundcolorblue>
+ <backgroundcolorgreen>232</backgroundcolorgreen>
+ <backgroundcolorred>201</backgroundcolorred>
+ <bordercolorblue>90</bordercolorblue>
+ <bordercolorgreen>58</bordercolorgreen>
+ <bordercolorred>14</bordercolorred>
+ <fontbold>N</fontbold>
+ <fontcolorblue>90</fontcolorblue>
+ <fontcolorgreen>58</fontcolorgreen>
+ <fontcolorred>14</fontcolorred>
+ <fontitalic>N</fontitalic>
+ <fontname>Segoe UI</fontname>
+ <fontsize>11</fontsize>
+ <height>50</height>
+ <xloc>64</xloc>
+ <yloc>48</yloc>
+ <note>The Check DB Connections workflow action verifies connectivity
with one or several databases.
+The example verifies the connection to "hop-samples" and pauses for 100 ms
before proceeding.</note>
+ <width>652</width>
+ </notepad>
+ </notepads>
+ <attributes/>
+</workflow>
diff --git
a/plugins/actions/tableexists/src/main/samples/actions/table-exists.hwf
b/plugins/actions/tableexists/src/main/samples/actions/table-exists.hwf
new file mode 100644
index 0000000000..3536ed0895
--- /dev/null
+++ b/plugins/actions/tableexists/src/main/samples/actions/table-exists.hwf
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+ <name>table-exists</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <workflow_version/>
+ <created_user>-</created_user>
+ <created_date>2025/10/27 17:51:38.821</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2025/10/27 17:51:38.821</modified_date>
+ <parameters>
+ </parameters>
+ <actions>
+ <action>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <DayOfMonth>1</DayOfMonth>
+ <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+ <hour>12</hour>
+ <intervalMinutes>60</intervalMinutes>
+ <intervalSeconds>0</intervalSeconds>
+ <minutes>0</minutes>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <weekDay>1</weekDay>
+ <parallel>N</parallel>
+ <xloc>128</xloc>
+ <yloc>160</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Table exists</name>
+ <description/>
+ <type>TABLE_EXISTS</type>
+ <attributes/>
+ <connection>hop-samples</connection>
+ <schemaname>PUBLIC</schemaname>
+ <tablename>dim_sample</tablename>
+ <parallel>N</parallel>
+ <xloc>320</xloc>
+ <yloc>160</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Table exists 2</name>
+ <description/>
+ <type>TABLE_EXISTS</type>
+ <attributes/>
+ <connection>hop-samples</connection>
+ <schemaname>PUBLIC</schemaname>
+ <tablename>dim_sample_test</tablename>
+ <parallel>N</parallel>
+ <xloc>672</xloc>
+ <yloc>160</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Write to log</name>
+ <description/>
+ <type>WRITE_TO_LOG</type>
+ <attributes/>
+ <loglevel>Basic</loglevel>
+ <logmessage>
+###################################
+- Success: table "dim_sample" exists.
+###################################</logmessage>
+ <logsubject/>
+ <parallel>N</parallel>
+ <xloc>480</xloc>
+ <yloc>160</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Write to log 2</name>
+ <description/>
+ <type>WRITE_TO_LOG</type>
+ <attributes/>
+ <loglevel>Basic</loglevel>
+ <logmessage>
+###################################
+- Failed: table "dim_sample_test" does not exist.
+###################################</logmessage>
+ <logsubject/>
+ <parallel>N</parallel>
+ <xloc>864</xloc>
+ <yloc>160</yloc>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>Table exists</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>Table exists</from>
+ <to>Write to log</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Write to log</from>
+ <to>Table exists 2</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Table exists 2</from>
+ <to>Write to log 2</to>
+ <enabled>Y</enabled>
+ <evaluation>N</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ </hops>
+ <notepads>
+ <notepad>
+ <backgroundcolorblue>251</backgroundcolorblue>
+ <backgroundcolorgreen>232</backgroundcolorgreen>
+ <backgroundcolorred>201</backgroundcolorred>
+ <bordercolorblue>90</bordercolorblue>
+ <bordercolorgreen>58</bordercolorgreen>
+ <bordercolorred>14</bordercolorred>
+ <fontbold>N</fontbold>
+ <fontcolorblue>90</fontcolorblue>
+ <fontcolorgreen>58</fontcolorgreen>
+ <fontcolorred>14</fontcolorred>
+ <fontitalic>N</fontitalic>
+ <fontname>Segoe UI</fontname>
+ <fontsize>11</fontsize>
+ <height>50</height>
+ <xloc>128</xloc>
+ <yloc>80</yloc>
+ <note>The first table exists action checks if the table "dim_sample"
exists; the expected result is success.
+The second table exists action checks if the table "dim_sample_test" exists;
the expected result is false.</note>
+ <width>683</width>
+ </notepad>
+ </notepads>
+ <attributes/>
+</workflow>