SQL-DB Operations
This function block lets you perform common SQL tasks (INSERT, QUERY, UPDATE, DELETE, EXECUTE) against a connected database. It provides a simple UI to select the desired operation, enter a table name when required, and feed the required inputs using sockets. Operations are executed in the background so the interface remains responsive.
π₯ Inputs (sockets)
Depending on the selected SQL operation, the block exposes different input sockets. Each listed name is a socket you can connect to other blocks.
Common sockets used by all methods
EnableMust be set to true to run the selected operation.DB ClientA database client reference provided by a separate connection block (see Tips and Tricks).
Per-method sockets
INSERT
JSON DataData to insert into the selected table (JSON/dictionary).
QUERY
Query StringSQL SELECT or other query string to run.
UPDATE
JSON DataUpdate values (JSON/dictionary).JSON Data(Where Conditions)Where conditions to select rows to update.
DELETE
JSON Data(Where Conditions)Where conditions to select rows to delete.
EXECUTE
Statement StringRaw SQL statement to execute (use with care).
Note: The block will show or hide the Table Name input control depending on the chosen operation.
π€ Outputs (sockets)
Output DataReturns the result of the operation (for example query rows, affected row info, or operation-specific data).Success?Boolean indicating whether the operation completed successfully.
πΉοΈ Controls (widgets)
Select SQL OperationDropdown to choose one of: INSERT / QUERY / UPDATE / DELETE / EXECUTE. Changing this updates available input sockets to match the chosen operation.Table NameText field for the target table name. Hidden automatically when not required (for example when usingEXECUTE).
βοΈ Running mechanism
The block only runs when the
Enablesocket receives a true value.It requires a valid
DB Clientsocket connected (typically provided by a database connection block).When triggered, the block runs the selected operation in the background and returns
Output DataandSuccess?when finished.Any problems (invalid inputs, missing client, malformed JSON, or SQL errors) are reported in the blockβs message/log area.
β¨ Key features
Dynamic sockets that adapt to the chosen SQL operation for a clean UI.
Background execution to keep the interface responsive during long-running database calls.
Simple JSON-based inputs for INSERT and UPDATE to make feeding tabular data easy.
Clear success indicator and returned result data for further processing.
π Usage instructions
Provide a database client to the
DB Clientsocket (see Tips and Tricks).Choose the desired operation with
Select SQL Operation.If applicable, enter the target table into
Table Name.Connect the required data sockets for the chosen operation (e.g.,
JSON Datafor INSERT).Send a true signal to
Enableto run the operation.Inspect
Output DataandSuccess?to continue processing in your scenario.
π‘ Tips and Tricks
For establishing connections, use
SQL-DB Client Connectto create and supply theDB Clientsocket.Prepare insert/update payloads using
Data to JSONso the data format matches expected JSON/dictionary inputs.If you build SQL strings dynamically, use
String InputorString Mergeto compose the query or statement before feeding it intoQuery StringorStatement String.Store or share frequently used DB clients or results using
Data Write Local/Data Read Localor the global variants for cross-scenario access.Use
Parse Data Dictionaryto extract fields from returned query rows and feed them into other blocks.Use
Debug Inputto quickly log and inspect intermediate data going into the block when troubleshooting.If you need to save query results for later, combine with
CSV Exportto write output data to a file.
π οΈ Troubleshooting
DB Clientis not valid Ensure you connected a proper database client (useSQL-DB Client Connect). The block will display an error if the client is missing or invalid.Operation returns error Check the provided JSON payload or SQL string for correctness. Use
Debug InputorParse Data Dictionaryto inspect inputs and outputs.No response or long wait The block runs operations in the background, but long queries can still take time. Keep queries small or verify that the database is reachable and responsive.
Malformed JSON When using JSON inputs, validate the JSON with
Data to JSONor check contents with logging blocks before connecting.
If problems persist, inspect the blockβs message/log output for hints and adjust inputs or database settings accordingly.
Last updated
Was this helpful?