Skip to content

Commit 497a914

Browse files
committed
Added information to the README.md file that explains what the pack does.
1 parent 754f7a6 commit 497a914

File tree

1 file changed

+71
-7
lines changed

1 file changed

+71
-7
lines changed

README.md

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,80 @@
1-
# sql Integration Pack
1+
# SQL Integration Pack
2+
Query, Insert, Update, and Delete information from PostgreSQL, SQLite, MsSQL, MySQL, Oracle, Firebird, and Sybase Databases
3+
4+
## Pre-Requisites
5+
This pack is set up to provide funcationality for the above databases. For MySQL and MsSQL we need to install 2 system packages.
6+
7+
#### MySQL
8+
``` shell
9+
yum install mysql-devel
10+
```
11+
12+
#### MsSQL
13+
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017
14+
``` shell
15+
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
16+
yum install msodbcsql17
17+
yum install unixODBC-devel
18+
```
19+
20+
## Quick Start
21+
22+
1. Install the pack
23+
24+
``` shell
25+
st2 pack install sql
26+
```
27+
28+
2. Execute an action (example: query)
29+
30+
``` shell
31+
st2 run sql.query host=test_serve.domain.tld username=test_user password=test_password database=test_database database_type=postgresql query="select * from test;"
32+
```
233

334
## Configuration
4-
TODO: Describe configuration
35+
Copy the example configuration in [sql.yaml.example](./sql.yaml.example)
36+
to `/opt/stackstorm/configs/sql.yaml` and edit as required.
37+
38+
It can contain an array of one or more sets of SQL connection parameters, like this:
39+
40+
``` yaml
41+
---
42+
sql:
43+
postgresql:
44+
host: postgresql_db.domain.tld
45+
46+
password: Password
47+
database: TestDatabase
48+
database_type: postgresql
49+
mysql:
50+
host: mysql_db.domain.tld
51+
52+
password: NewPassword
53+
database: TestDatabase
54+
database_type: mysql
55+
```
56+
57+
Each entry should contain
558

59+
* ``host`` - Database hostname
60+
* ``username`` - Username to authenticate to DB
61+
* ``password`` - Password for DB authentication
62+
* ``database`` - Database to use
63+
* ``database_type`` - The type of database that is being connected to.
664

7-
# Sensors
65+
When running actions, you can pass in the name of a connection, e.g.
66+
`st2 run sql.query connection="postgresql" query="select * from test;"`
867

9-
## Example Sensor
10-
TODO: Describe sensor
68+
Alternatively, when running an action, you can pass in the host, username, password, database, database_type parameters. These parameters can also be used for overrides if you wish to use the configs as well.
1169

70+
**Note** : When modifying the configuration in `/opt/stackstorm/configs/` please remember to tell StackStorm to load these new values by running `st2ctl reload --register-configs`
1271

1372
# Actions
1473

15-
## example
16-
TODO: Describe action
74+
| Action | Description |
75+
|--------|-------------|
76+
| query | Generic query action to get inforamtion from the database. |
77+
| insert | Insert data into a database table. Insert data is passed as an object. |
78+
| insert_bulk | Bulk insert data into a database table. Insert data is passed as an array of objects. |
79+
| update | Update data in a database table. |
80+
| delete | Delete data from a database table. |

0 commit comments

Comments
 (0)