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
Switched connection to include port and to use built in module to format URL instead of doing it with interpolation. Added documentation to readme about how to connect to different databases with examples
Copy file name to clipboardExpand all lines: README.md
+13-6Lines changed: 13 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,10 +28,12 @@ yum install unixODBC-devel
28
28
2. Execute an action (example: query)
29
29
30
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;"
31
+
st2 run sql.query host=test_serve.domain.tld username=test_user password=test_password database=test_database drivername=postgresql query="select * from test;"
32
32
```
33
33
34
-
## Configuration
34
+
## Configuration and Connecting to Databases
35
+
Connecting to different types of databases is shown below. Connecting to different databases is donein the same manor except with sqlite where all you need to pass is the path to the database in the database option. This is show below. For more information about connections please refer to [SQLAlchemy Connection Docs](https://docs.sqlalchemy.org/en/latest/core/engines.html)
36
+
35
37
Copy the example configuration in [sql.yaml.example](./sql.yaml.example)
36
38
to `/opt/stackstorm/configs/sql.yaml` and edit as required.
*``database_type`` - The type of database that is being connected to.
69
+
*``port`` - Port to connect to database on. If Default leave blank
70
+
*``drivername`` - The type of database that is being connected to.
64
71
65
72
When running actions, you can pass in the name of a connection, e.g.
66
73
`st2 run sql.query connection="postgresql" query="select * from test;"`
67
74
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.
75
+
Alternatively, when running an action, you can pass in the host, username, password, database, port, drivername parameters. These parameters can also be used for overrides if you wish to use the configs as well.
69
76
70
77
**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`
Copy file name to clipboardExpand all lines: actions/delete.yaml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,11 @@
27
27
type: string
28
28
description: "Optional override of the database in <connection> (required if <connection> is not specified). Database to connect to, to run querys against."
29
29
required: false
30
-
database_type:
30
+
port:
31
+
description: "Port to connect to database on. If Default leave blank"
32
+
type: integer
33
+
required: false
34
+
drivername:
31
35
type: string
32
36
description: "Optional override of the database_type in <connection> (required if <connection> is not specified). The type of database that is being connected to."
Copy file name to clipboardExpand all lines: actions/insert.yaml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,11 @@
27
27
type: string
28
28
description: "Optional override of the database in <connection> (required if <connection> is not specified). Database to connect to, to run querys against."
29
29
required: false
30
-
database_type:
30
+
port:
31
+
description: "Port to connect to database on. If Default leave blank"
32
+
type: integer
33
+
required: false
34
+
drivername:
31
35
type: string
32
36
description: "Optional override of the database_type in <connection> (required if <connection> is not specified). The type of database that is being connected to."
Copy file name to clipboardExpand all lines: actions/insert_bulk.yaml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,11 @@
27
27
type: string
28
28
description: "Optional override of the database in <connection> (required if <connection> is not specified). Database to connect to, to run querys against."
29
29
required: false
30
-
database_type:
30
+
port:
31
+
description: "Port to connect to database on. If Default leave blank"
32
+
type: integer
33
+
required: false
34
+
drivername:
31
35
type: string
32
36
description: "Optional override of the database_type in <connection> (required if <connection> is not specified). The type of database that is being connected to."
Copy file name to clipboardExpand all lines: actions/query.yaml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,11 @@
27
27
type: string
28
28
description: "Optional override of the database in <connection> (required if <connection> is not specified). Database to connect to, to run querys against."
29
29
required: false
30
-
database_type:
30
+
port:
31
+
description: "Port to connect to database on. If Default leave blank"
32
+
type: integer
33
+
required: false
34
+
drivername:
31
35
type: string
32
36
description: "Optional override of the database_type in <connection> (required if <connection> is not specified). The type of database that is being connected to."
Copy file name to clipboardExpand all lines: actions/update.yaml
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,11 @@
27
27
type: string
28
28
description: "Optional override of the database in <connection> (required if <connection> is not specified). Database to connect to, to run querys against."
29
29
required: false
30
-
database_type:
30
+
port:
31
+
description: "Port to connect to database on. If Default leave blank"
32
+
type: integer
33
+
required: false
34
+
drivername:
31
35
type: string
32
36
description: "Optional override of the database_type in <connection> (required if <connection> is not specified). The type of database that is being connected to."
0 commit comments