Using SQL in Nyno Workflows
Extension: nyno-sql
Core Goal: Execute an SQL query against a PostgreSQL database and store the result in the workflow context.
workflow:
- step: nyno-sql
args:
- "SELECT * FROM users WHERE id = $1"
- [123]
Input options:
-
args:[Query String]— The SQL query to execute (required).[Parameters Array]— Optional array of parameters for parameterized queries.
-
contextinput keys:set_context(optional) — Specify a custom key to store the result in the workflow context. Defaults tonyno_sql.
Output
-
contextoutput keys:nyno_sql(or dynamic key fromset_context) — Array of rows returned by the query.nyno_sql.error(or dynamic key) — Error object if the query fails.
Input examples
For individual step inside any workflow:
- step: nyno-sql
args:
- "SELECT * FROM users WHERE id = $1"
- [123]
Full Workflow Example
context:
QUERY: "SELECT * FROM users WHERE status = $1"
PARAMS: ["active"]
workflow:
- step: nyno-sql
args:
- ${QUERY}
- ${PARAMS} # optional