Usql client for Direktiv
-
License: Apache-2.0
-
Issue Tracking: https://github.com/direktiv-apps/usql/issues
-
Maintainer: direktiv.io
Usql is a universal command-line interface for PostgreSQL, MySQL, Oracle Database, SQLite3, Microsoft SQL Server, and many other databases including NoSQL and non-relational databases. This service provides easy access to database from Direktiv and supports variables and interpolation as well.
functions:
- id: usql
image: direktiv/usql
type: knative-workflow
- id: insert
type: action
action:
function: usql
input:
connection: pg://direktiv:rbRIw3I6%7B5%29%5Dda%287m.R_%5D%3Eh%5D@192.168.0.177:5432
queries:
- query: select * from mydata
- id: insert
type: action
action:
function: usql
input:
connection: pg://direktiv:rbRIw3I6%7B5%29%5Dda%287m.R_%5D%3Eh%5D@192.168.0.177:5432
queries:
- query: select * from mydata where id = :'ID'
args:
- ID=3a7ff4a5-fadb-4d41-97bb-86917cdad46a
- id: insert
type: action
action:
function: usql
input:
connection: pg://direktiv:rbRIw3I6%7B5%29%5Dda%287m.R_%5D%3Eh%5D@192.168.0.177:5432
queries:
- query: insert into testme values ('hello world')
The service responds with one JSON payload per SQL query.
{
"queries": [
{
"result": [
{
"id": "c5c20864-2c1b-47e2-94ab-185a3e8cf9ee",
"name": 123
}
],
"success": true
},
{
"result": "INSERT 1",
"success": true
}
]
}
Type | Description |
---|---|
io.direktiv.command.error | Command execution failed |
io.direktiv.output.error | Template error for output generation of the service |
io.direktiv.ri.error | Can not create information object from request |
Properties
Name | Type | Go type | Required | Default | Description | Example |
---|---|---|---|---|---|---|
queries | []PostOKBodyQueriesItems | []*PostOKBodyQueriesItems |
Properties
Name | Type | Go type | Required | Default | Description | Example |
---|---|---|---|---|---|---|
result | interface{} | interface{} |
||||
success | boolean | bool |
Properties
Name | Type | Go type | Required | Default | Description | Example |
---|---|---|---|---|---|---|
connection | string | string |
✓ | Connection string for sql commands. This will be used for all commands and has to be URL-encoded. | pg://myuser:mypwd@MYDATABAESERVER:5432 |
|
queries | []PostParamsBodyQueriesItems | []*PostParamsBodyQueriesItems |
List of sql commands. Commands can use interpolation: query: select * from table where id = :'ID' args: ID=123 |
{"args":["KEY=1"],"query":"select * from mytable where key = :'KEY'"} |
Properties
Name | Type | Go type | Required | Default | Description | Example |
---|---|---|---|---|---|---|
args | []string | []string |
ARG=myarg |
|||
query | string | string |
select * from table where value = :'ARG' |