Skip to main content

Execute a Query - Sequelize Node

Problem#

You want to execute a SQL query using Ignite-Sequelize node.

Solution#

Drag and drop an Inject node to start the flow. Use a Sequelize node and draw a wire from inject node to sequelize node. Use the config node inside Sequelize node to define your database configuration. Drag and drop a Debug node and connect to sequelize node to print out the response in the debug window.

Example#

img

Flow JSON
[{"id":"5c243fd4.8e65d","type":"inject","z":"e80b077d.dc8e78","name":"","topic":"start","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":280,"wires":[["e7daf9cc.61e858"]]},{"id":"e7daf9cc.61e858","type":"sequelize","z":"e80b077d.dc8e78","name":"","usepayload":false,"query":"SELECT * FROM Users;","database":"","output":true,"outputs":1,"x":560,"y":280,"wires":[["bb949601.188718"]]},{"id":"bb949601.188718","type":"debug","z":"e80b077d.dc8e78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":280,"wires":[]}]

Discussion#

Sequelize node can be used to connect to a variety of Databases.

In the example flow, we are executing a simple select statement using a Sequelize node.

The Catch receives the error which passes the message back to the Function node to an error response.

You can also supply query via payload by ticking the checkbox against "Use Query From Payload".