Hi,
I am working on a workflow which requires to enter some data to questdb. I want the workflow to remove all previous values from the table and add new ones each time the workflow executes. I have added two questdb nodes for this purpose. The first one executes the truncate table command which removes all data from the table ( keeps the row names - do not delete table.). The second one runs the query to insert the new values to the questdb. My workflow stops once it executes the first questdb node. How can I fix this?
I have added my workflow below. I tried to change the position of the first questdb node , but yields the same result only.
{
"name": "MQTT-CLIENT-modified",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
-160,
340
]
},
{
"parameters": {
"path": "10f00915-b235-454b-a63f-a52bc8a3d8df",
"responseMode": "lastNode",
"responseData": "allEntries",
"options": {}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
60,
340
],
"webhookId": "10f00915-b235-454b-a63f-a52bc8a3d8df",
"notesInFlow": true,
"notes": "GET method to initiate the workflow"
},
{
"parameters": {
"authentication": "basicAuth",
"url": "http://GSuPuBAdofKT2xLWLNZPwPSGedHrMlgq@mqtt-broker:8888/api/v1/session/show/--client_id\n",
"allowUnauthorizedCerts": true,
"options": {}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
390,
340
],
"notesInFlow": true,
"credentials": {
"httpBasicAuth": "Unnamed credential"
},
"notes": "HTTP Request to fetch the list of clients"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"table\"][0][\"client_id\"]}}",
"operation": "isEmpty"
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
720,
340
],
"notesInFlow": true,
"notes": "Checking whether clients are present or not"
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "Result",
"value": "Error in obtaining list of all clients"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1010,
170
],
"notesInFlow": true,
"notes": "Sets the error message when no client is connected"
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "client_id",
"value": "={{$json[\"table\"]}}"
}
],
"boolean": [],
"number": []
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1010,
510
],
"notesInFlow": true,
"notes": "Sets the client list"
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1320,
170
]
},
{
"parameters": {},
"name": "NoOp1",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
2000,
510
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO MQTTClient(client_id) VALUES ($1);\n",
"additionalFields": {
"queryParams": "client_id"
}
},
"name": "QuestDB",
"type": "n8n-nodes-base.questDb",
"typeVersion": 1,
"position": [
1750,
510
],
"credentials": {
"questDb": "QuestDB account 3"
}
},
{
"parameters": {
"fieldToSplitOut": "client_id",
"options": {}
},
"name": "Item Lists",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
1320,
510
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "TRUNCATE TABLE MQTTClient;",
"additionalFields": {}
},
"name": "QuestDB1",
"type": "n8n-nodes-base.questDb",
"typeVersion": 1,
"position": [
1550,
510
],
"credentials": {
"questDb": "QuestDB account 3"
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
],
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
]
]
},
"Item Lists": {
"main": [
[
{
"node": "QuestDB1",
"type": "main",
"index": 0
}
]
]
},
"QuestDB": {
"main": [
[
{
"node": "NoOp1",
"type": "main",
"index": 0
}
]
]
},
"QuestDB1": {
"main": [
[
{
"node": "QuestDB",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": 37
}```