Skip to content

Commit 3575d27

Browse files
authored
[PLGN-654] [PLGN-655] SQL - bumping version of SQLAlchemy and SDK used (#2212)
* PLGN-654_655-bumping version of SQLAlchemy and SDK used * PLGN-654_655-bumping version of SQLAlchemy and SDK used
1 parent 19c3183 commit 3575d27

14 files changed

Lines changed: 95 additions & 84 deletions

File tree

plugins/sql/.CHECKSUM

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"spec": "ce3511ffd8e98051a98c26d3af0878aa",
3-
"manifest": "1b6650465b4b888c2629db489e77977d",
4-
"setup": "0d462ae92ec8f34edcf6fac21f329bec",
2+
"spec": "318b640fa99101297941ad7837fac52b",
3+
"manifest": "74ac90f8de35dc56e5d60e4c93a135b7",
4+
"setup": "fa08b073c2fcd742510da31ed0a3c48a",
55
"schemas": [
66
{
77
"identifier": "query/schema.py",
8-
"hash": "d58182a875e9e416627804d5ed3709ae"
8+
"hash": "bdd1ccd7baccfebd25b71fe4b79a0515"
99
},
1010
{
1111
"identifier": "connection/schema.py",
12-
"hash": "49f7eb7bca29f5fdc004af1f13ee1a3a"
12+
"hash": "f49cbb13c885d7d625e1d1d38cd98f9d"
1313
}
1414
]
1515
}

plugins/sql/Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
FROM rapid7/insightconnect-python-3-38-plugin:4
1+
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:5
22

3-
# Add any custom package dependencies here
4-
# NOTE: Add pip packages to requirements.txt
3+
LABEL organization=rapid7
4+
LABEL sdk=python
55

6-
# End package dependencies
76
ENV TDSVER=8.0
87
RUN pip install --upgrade pip
98
RUN apt-get update && apt-get install -y libxslt-dev libxml2-dev unixodbc unixodbc-dev freetds-dev tdsodbc default-libmysqlclient-dev libpq-dev
109
RUN sed -i.bak 's/# TDS protocol version/tds version = 8.0/' /etc/freetds/freetds.conf
1110
RUN sed -i.bak '/tds version = 8.0/a\ \tclient charset = UTF-8' /etc/freetds/freetds.conf
1211

13-
# Add source code
1412
WORKDIR /python/src
13+
1514
ADD ./plugin.spec.yaml /plugin.spec.yaml
16-
ADD . /python/src
15+
ADD ./requirements.txt /python/src/requirements.txt
1716

18-
# Install pip dependencies
1917
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2018

21-
# Install plugin
22-
RUN python setup.py build && python setup.py install
19+
ADD . /python/src
20+
21+
RUN python setup.py build && python setup.py install
2322

2423
# User to run plugin code. The two supported users are: root, nobody
2524
USER nobody

plugins/sql/bin/komand_sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python
2-
# GENERATED BY KOMAND SDK - DO NOT EDIT
2+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
33
import os
44
import json
55
from sys import argv
66

77
Name = "SQL"
88
Vendor = "rapid7"
9-
Version = "3.0.6"
9+
Version = "3.0.7"
1010
Description = "The SQL plugin allows you to run SQL queries"
1111

1212

@@ -23,7 +23,7 @@ def main():
2323
monkey.patch_all()
2424

2525
import insightconnect_plugin_runtime
26-
from komand_sql import connection, actions, triggers
26+
from komand_sql import connection, actions, triggers, tasks
2727

2828
class ICONSql(insightconnect_plugin_runtime.Plugin):
2929
def __init__(self):
@@ -35,7 +35,7 @@ def main():
3535
connection=connection.Connection()
3636
)
3737
self.add_action(actions.Query())
38-
38+
3939

4040
"""Run plugin"""
4141
cli = insightconnect_plugin_runtime.CLI(ICONSql())

plugins/sql/help.md

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ This plugin allows users to run and execute queries against a SQL database.
2323
# Documentation
2424

2525
## Setup
26-
27-
The connection configuration accepts the following parameters:
26+
27+
The connection configuration accepts the following parameters:
2828

2929
|Name|Type|Default|Required|Description|Enum|Example|
30-
|----|----|-------|--------|-----------|----|-------|
30+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
3131
|credentials|credential_username_password|None|True|Database username and password|None|{ "username": "user@example.com", "password": "mypassword"}|
3232
|db|string|None|True|Database name|None|database_name|
3333
|host|string|None|True|Database hostname|None|198.51.100.1|
3434
|port|string|None|False|Database port|None|1433|
3535
|type|string|None|True|Database type (MSSQL, MySQL, PostgreSQL)|['MSSQL', 'MySQL', 'PostgreSQL']|MySQL|
36-
36+
3737
Example input:
3838

3939
```
4040
{
4141
"credentials": {
42-
"username": "user@example.com",
43-
"password": "mypassword"
42+
"password": "mypassword",
43+
"username": "user@example.com"
4444
},
4545
"db": "database_name",
4646
"host": "198.51.100.1",
@@ -53,17 +53,18 @@ Example input:
5353

5454
### Actions
5555

56-
#### Query
5756

58-
This action is used to run an arbitrary SQL query against the connected database.
57+
#### Query
58+
59+
This action is used to run an arbitrary SQL query against the connected database
5960

6061
##### Input
6162

6263
|Name|Type|Default|Required|Description|Enum|Example|
63-
|----|----|-------|--------|-----------|----|-------|
64+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
6465
|parameters|object|None|False|Parameters for query|None|{ "name": "user" }|
6566
|query|string|None|True|Query to run|None|SELECT * FROM example WHERE name=:name|
66-
67+
6768
Example input:
6869

6970
```
@@ -77,48 +78,43 @@ Example input:
7778

7879
##### Output
7980

80-
|Name|Type|Required|Description|
81-
|----|----|--------|-----------|
82-
|header|[]string|False|Array of header fields for the columns|
83-
|results|[]object|False|Result rows, each as an object with header keys|
84-
|status|string|True|Status message|
85-
81+
|Name|Type|Required|Description|Example|
82+
| :--- | :--- | :--- | :--- | :--- |
83+
|header|[]string|False|Array of header fields for the columns|["name", "surname", "index", "alias"]|', '|results|[]object|False|Result rows, each as an object with header keys|[{"name": "User", "index": "1", "Surname": "Example", "alias": "Test"}]|
84+
|status|string|True|Status message|operation success|
85+
8686
Example output:
8787

8888
```
8989
{
90-
"header": [
91-
"name",
92-
"surname",
93-
"index",
94-
"alias"
95-
],
96-
"results": [
97-
{
98-
"name": "User",
99-
"index": "1",
100-
"Surname": "Example",
101-
"alias": "Test"
102-
}
103-
],
90+
"header": "name",
91+
"results": {
92+
"Surname": "Example",
93+
"alias": "Test",
94+
"index": "1",
95+
"name": "User"
96+
},
10497
"status": "operation success"
10598
}
10699
```
107-
108100
### Triggers
101+
102+
*This plugin does not contain any triggers.*
103+
### Tasks
104+
105+
*This plugin does not contain any tasks.*
109106

110-
_This plugin does not contain any triggers._
111-
112-
### Custom Output Types
113-
114-
_This plugin does not contain any custom output types._
107+
### Custom Types
108+
109+
*This plugin does not contain any custom output types.*
115110

116111
## Troubleshooting
117-
118-
For the SQL query action, be sure that your query is valid SQL.
112+
113+
*There is no troubleshooting for this plugin.*
119114

120115
# Version History
121116

117+
* 3.0.7 - Bumped version of SQLAlchemy used to version 1.2.18 | bump version of SDK used to version 5
122118
* 3.0.6 - Update plugin runtime to InsightConnect
123119
* 3.0.5 - Update pymssql version library to support latest MSSQL update 2019 15.0.4223.1
124120
* 3.0.4 - Fix issue with get method's keyword argument in Query action
@@ -139,6 +135,8 @@ For the SQL query action, be sure that your query is valid SQL.
139135

140136
# Links
141137

138+
* [SQLAlchemy](http://docs.sqlalchemy.org/en/latest/)
139+
142140
## References
143141

144142
* [SQLAlchemy](http://docs.sqlalchemy.org/en/latest/)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
# GENERATED BY KOMAND SDK - DO NOT EDIT
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
23
from .query.action import Query
4+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# GENERATED BY KOMAND SDK - DO NOT EDIT
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
22
from .action import Query

plugins/sql/komand_sql/actions/query/schema.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# GENERATED BY KOMAND SDK - DO NOT EDIT
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
22
import insightconnect_plugin_runtime
33
import json
44

55

66
class Component:
7-
DESCRIPTION = "SQL query"
7+
DESCRIPTION = "Run an arbitrary SQL query against the connected database"
88

99

1010
class Input:
1111
PARAMETERS = "parameters"
1212
QUERY = "query"
13-
13+
1414

1515
class Output:
1616
HEADER = "header"
1717
RESULTS = "results"
1818
STATUS = "status"
19-
19+
2020

2121
class QueryInput(insightconnect_plugin_runtime.Input):
22-
schema = json.loads("""
22+
schema = json.loads(r"""
2323
{
2424
"type": "object",
2525
"title": "Variables",
@@ -39,7 +39,8 @@ class QueryInput(insightconnect_plugin_runtime.Input):
3939
},
4040
"required": [
4141
"query"
42-
]
42+
],
43+
"definitions": {}
4344
}
4445
""")
4546

@@ -48,7 +49,7 @@ def __init__(self):
4849

4950

5051
class QueryOutput(insightconnect_plugin_runtime.Output):
51-
schema = json.loads("""
52+
schema = json.loads(r"""
5253
{
5354
"type": "object",
5455
"title": "Variables",
@@ -80,7 +81,8 @@ class QueryOutput(insightconnect_plugin_runtime.Output):
8081
},
8182
"required": [
8283
"status"
83-
]
84+
],
85+
"definitions": {}
8486
}
8587
""")
8688

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# GENERATED BY KOMAND SDK - DO NOT EDIT
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
22
from .connection import Connection

plugins/sql/komand_sql/connection/schema.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GENERATED BY KOMAND SDK - DO NOT EDIT
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
22
import insightconnect_plugin_runtime
33
import json
44

@@ -9,10 +9,10 @@ class Input:
99
HOST = "host"
1010
PORT = "port"
1111
TYPE = "type"
12-
12+
1313

1414
class ConnectionSchema(insightconnect_plugin_runtime.Input):
15-
schema = json.loads("""
15+
schema = json.loads(r"""
1616
{
1717
"type": "object",
1818
"title": "Variables",
@@ -62,23 +62,23 @@ class ConnectionSchema(insightconnect_plugin_runtime.Input):
6262
"definitions": {
6363
"credential_username_password": {
6464
"id": "credential_username_password",
65-
"type": "object",
6665
"title": "Credential: Username and Password",
6766
"description": "A username and password combination",
67+
"type": "object",
6868
"properties": {
69+
"username": {
70+
"type": "string",
71+
"title": "Username",
72+
"description": "The username to log in with",
73+
"order": 1
74+
},
6975
"password": {
7076
"type": "string",
7177
"title": "Password",
72-
"displayType": "password",
7378
"description": "The password",
7479
"format": "password",
80+
"displayType": "password",
7581
"order": 2
76-
},
77-
"username": {
78-
"type": "string",
79-
"title": "Username",
80-
"description": "The username to log in with",
81-
"order": 1
8282
}
8383
},
8484
"required": [
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+

0 commit comments

Comments
 (0)