You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-6Lines changed: 74 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,25 +14,48 @@ Following actions are inside:
14
14
15
15
``LOOKUP BY PRIMARY KEY`` - this action will execute select query from specified table, as criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"). The action returns only one result (a primary key is unique).
16
16
17
+
``UPSERT BY PRIMARY KEY`` - this action will execute select command from specified table, as search criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"), and execute insert command by PRIMARY KEY with specified field, if result does not found, else - action will execute update command by PRIMARY KEY with specified field. The action returns only one result row (a primary key is unique).
18
+
17
19
``DELETE BY PRIMARY KEY`` - this action will execute delete query from specified table, as criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"). The action returns an integer value that indicates the number of rows affected, the returned value can be 0 or 1 (a primary key is unique).
18
20
### How works
19
21
20
22
### Requirements
21
23
Before you can deploy any code into elastic.io **you must be a registered elastic.io platform user**. Please see our home page at [http://www.elastic.io](http://www.elastic.io) to learn how.
22
24
#### Environment variables
23
-
For unit-testing
25
+
For unit-testing is needed to specify following environment variables:
26
+
1. Connection to MSSQL:
27
+
-``CONN_USER_MSSQL`` - user login
28
+
-``CONN_PASSWORD_MSSQL`` - user password
29
+
-``CONN_DBNAME_MSSQL`` - DataBase name
30
+
-``CONN_HOST_MSSQL`` - DataBase host
31
+
-``CONN_PORT_MSSQL`` - DataBase port
32
+
2. Connection to MySQL:
33
+
-``CONN_USER_MYSQL`` - user login
34
+
-``CONN_PASSWORD_MYSQL`` - user password
35
+
-``CONN_DBNAME_MYSQL`` - DataBase name
36
+
-``CONN_HOST_MYSQL`` - DataBase host
37
+
-``CONN_PORT_MYSQL`` - DataBase port
38
+
3. Connection to Oracle:
39
+
-``CONN_USER_ORACLE`` - user login
40
+
-``CONN_PASSWORD_ORACLE`` - user password
41
+
-``CONN_DBNAME_ORACLE`` - DataBase name
42
+
-``CONN_HOST_ORACLE`` - DataBase host
43
+
-``CONN_PORT_ORACLE`` - DataBase port
44
+
4. Connection to PostgreSQL:
45
+
-``CONN_USER_POSTGRESQL`` - user login
46
+
-``CONN_PASSWORD_POSTGRESQL`` - user password
47
+
-``CONN_DBNAME_POSTGRESQL`` - DataBase name
48
+
-``CONN_HOST_POSTGRESQL`` - DataBase host
49
+
-``CONN_PORT_POSTGRESQL`` - DataBase port
24
50
#### Others
25
51
## Credentials
26
52
You may use following properties to configure a connection:
You can add the authorisation methods during the integration flow design or by going to your Settings > Security credentials > REST client and adding there.
29
55
### DB Engine
56
+
You are able to choose one of existing database types:
The action will execute select query from a ``Table`` dropdown field, as criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"). The action returns only one result (a primary key is unique).
124
148
Checkbox ``Don't throw Error on an Empty Result`` allows to emit an empty response, otherwise you will get an error on empty response.
As an input metadata you will get a Primary Key field to provide the data inside as a clause value.
128
152
153
+
### UPSERT BY PRIMARY KEY
154
+
The action will execute ``SELECT`` command from a ``Tables`` dropdown field, as search criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"), and execute ``INSERT`` command by PRIMARY KEY with specified field, if result does not found, else - action will execute ``UPDATE`` command by PRIMARY KEY with specified field. The action returns only one result row (a primary key is unique).
155
+
1. Find and select jdbc-component in the component repository
As an input metadata you will get all fields of selected table. [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY") is required field (will mark as asterisk) and other input fields are optional.
The action will execute delete query from a ``Table`` dropdown field, as criteria can be used only [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY"). The action returns count of affected rows.
@@ -134,6 +191,17 @@ Checkbox ``Don't throw Error on an Empty Result`` allows to emit an empty respon
As an input metadata you will get a Primary Key field to provide the data inside as a clause value.
136
193
194
+
## Current limitations
195
+
1. Only tables with one [PRIMARY KEY](https://en.wikipedia.org/wiki/Primary_key"PRIMARY KEY") is supported. You will see the message ``Table has not Primary Key. Should be one Primary Key
196
+
``, if the selected table doesn't have a primary key. Also, you will see the message ``Composite Primary Key is not supported
197
+
``, if the selected table has composite primary key.
198
+
2. Only following versions of database types are supported:
199
+
-``MySQL`` - compatible with MySQL Server 5.5, 5.6, 5.7 and 8.0.
200
+
-``PostgreSQL`` - compatible with PostgreSQL 8.2 and higher
201
+
-``Oracle`` - compatible with Oracle Database 8.1.7 - 12.1.0.2
202
+
-``MSSQL`` - compatible with Microsoft SQL Server 2008 R2 and higher
203
+
3. The current implementation of the action ``Upsert By Primary Key`` doesn't mark non-nullable fields as required fields at a dynamic metadata. In case of updating such fields with an empty value you will get SQL Exception ``Cannot insert the value NULL into...``. You should manually fill in all non-nullable fields with previous data, if you want to update part of columns in a row, even if data in that fields doesn't change.
0 commit comments