Skip to the content.

Tutorial: Create first connection

This page guide you through creating your first connection and configuring an action to make use of it. We will make use of a database connection to a simple synthetic dataset. In that way it will be possible to configure an sql type action.

In this tutorial we will create a script helloconnection that will execute a sql type action.

Pre-requisites

Create connection

First, we will create the configuration of the connection:

---
type: Connection
data:
  name: "simplesyntheticdataset"
  type: "db.sqlite"
  description: "Simple Synthetic Dataset for tutorials"
  environment: "tutorial"
  parameters:
  - name: "filePath"
    value: "#iesi.home#/data/tutorials"
  - name: "fileName"
    value: "simplesyntheticdataset.db3"

Next, load the configuration into the configuration repository. You should be getting used to this by now. You can always refresh this by having a look the following tutorial: Load configuration.

Create script

Now we can create the configuration file for the script to make use of the connection:

---
type: Script
data:
  type: "script"
  name: "helloconnection"
  description: "Hello Connection Tutorial Script"
  actions:
  - number: 1
    type: "sql.evaluateResult"
    name: "VerifyData"
    description: "Verify if Table1 contains data"
    errorExpected: "N"
    errorStop: "N"
    parameters:
    - name: "query"
      value: "select * from Table1"
    - name: "hasResult"
      value: "Y"
    - name: "connection"
      value: "simplesyntheticdataset"

Have a look at the action that we have defined in the above script:

Now, load the configuration into the configuration repository.

Execute the script

You should be getting used to executing scripts by now. You can always refresh this by having a look the following tutorial: Execute script.

Linux/Mac

./iesi-launch.sh -script helloconnection -env tutorial

Windows

./iesi-launch.cmd -script helloconnection -env tutorial

The following type output will appear on the screen:

Option -script (script) value = helloconnection
Option -version (version) value = 
Option -env (environment) value = tutorial
Option -paramlist (parameter list) value = 
Option -paramfile (parameter file) value = 
Option -actions (actions) value = 
Option -settings (settings) value = 
Option -impersonation (impersonation) value = 
Option -impersonate (impersonate) value = 

script.launcher.start
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2019-04-03 10:47:40,642 INFO  [iesi] - option.script=helloconnection
2019-04-03 10:47:40,643 INFO  [iesi] - option.version=-1
2019-04-03 10:47:40,643 INFO  [iesi] - option.file=
2019-04-03 10:47:40,644 INFO  [iesi] - option.env=tutorial
2019-04-03 10:47:40,644 INFO  [iesi] - option.paramlist=
2019-04-03 10:47:40,644 INFO  [iesi] - option.paramfile=
2019-04-03 10:47:40,644 INFO  [iesi] - option.actionselect=
2019-04-03 10:47:40,644 INFO  [iesi] - option.settings=
2019-04-03 10:47:40,646 INFO  [iesi] - option.impersonation=
2019-04-03 10:47:40,646 INFO  [iesi] - option.impersonate=
2019-04-03 10:47:40,843 INFO  [iesi] - exec.runid=7997a45b-7a09-4523-8ebb-ea348044d9b5
2019-04-03 10:47:41,049 INFO  [iesi] - script.name=helloconnection
2019-04-03 10:47:41,049 INFO  [iesi] - exec.env=tutorial
2019-04-03 10:47:41,068 INFO  [iesi] - action.name=VerifyData
2019-04-03 10:47:41,445 INFO  [iesi] - action.status=SUCCESS
2019-04-03 10:47:41,447 INFO  [iesi] - script.status=SUCCESS
2019-04-03 10:47:41,448 INFO  [iesi] - script.output=
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
script.launcher.end

The outcome of the script is a success, there is data in Table1.

You might want to start exploring alternative checks with this dataset. When you update the script setting hasResult=N: This will result in an error; there is data but you are not expecting it.

Option -script (script) value = helloconnection
Option -version (version) value = 
Option -env (environment) value = tutorial
Option -paramlist (parameter list) value = 
Option -paramfile (parameter file) value = 
Option -actions (actions) value = 
Option -settings (settings) value = 
Option -impersonation (impersonation) value = 
Option -impersonate (impersonate) value = 

script.launcher.start
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2019-04-03 10:50:41,832 INFO  [iesi] - option.script=helloconnection
2019-04-03 10:50:41,834 INFO  [iesi] - option.version=-1
2019-04-03 10:50:41,834 INFO  [iesi] - option.file=
2019-04-03 10:50:41,834 INFO  [iesi] - option.env=tutorial
2019-04-03 10:50:41,834 INFO  [iesi] - option.paramlist=
2019-04-03 10:50:41,834 INFO  [iesi] - option.paramfile=
2019-04-03 10:50:41,834 INFO  [iesi] - option.actionselect=
2019-04-03 10:50:41,834 INFO  [iesi] - option.settings=
2019-04-03 10:50:41,840 INFO  [iesi] - option.impersonation=
2019-04-03 10:50:41,840 INFO  [iesi] - option.impersonate=
2019-04-03 10:50:42,031 INFO  [iesi] - exec.runid=33a88ee7-71fb-45c3-ad66-6dadc21f2818
2019-04-03 10:50:42,224 INFO  [iesi] - script.name=helloconnection
2019-04-03 10:50:42,225 INFO  [iesi] - exec.env=tutorial
2019-04-03 10:50:42,245 INFO  [iesi] - action.name=VerifyData
2019-04-03 10:50:42,626 INFO  [iesi] - action.status=ERROR
2019-04-03 10:50:42,628 INFO  [iesi] - script.status=ERROR
2019-04-03 10:50:42,629 INFO  [iesi] - script.output=
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
script.launcher.end

Recap

We have now created a script that makes use of a connection and executed it on the tutorial environment. We can now start creating other connections to be used with the available action types.