AI SQL Query Generator from Database Schema
f75faa36-8d8d-460b-809b-40a612b3d82a
Latency
7259ms
Cost
$0.0026
Tokens
1,308
Status
successgemini-3-flash-preview
Workflow Graph
Trace
[
{
"data": {
"nodeType": "llm"
},
"event": "node_start",
"nodeId": "b7c3ca47-11b3-4378-81fa-68b2f56b295e",
"timestamp": 1783210648954
},
{
"data": {
"messages": 1,
"maxTokens": 1024
},
"event": "calling openai/gpt-4o",
"nodeId": "llm",
"timestamp": 1783210648954
},
{
"data": {
"model": "gpt-4o",
"provider": "openai"
},
"event": "llm_call",
"nodeId": "_context",
"timestamp": 1783210648954
},
{
"data": {
"model": "gemini-3-flash-preview",
"costUsd": 0.0017102999999999999,
"provider": "openai",
"latencyMs": 4375,
"promptTokens": 1,
"completionTokens": 684
},
"event": "llm_result",
"nodeId": "_context",
"timestamp": 1783210653330
},
{
"data": {
"status": "ok",
"nodeType": "llm"
},
"event": "node_end",
"nodeId": "b7c3ca47-11b3-4378-81fa-68b2f56b295e",
"timestamp": 1783210653330
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "977c3a82-440b-4d44-9042-47a673bcb52c",
"timestamp": 1783210653331
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210653331
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "977c3a82-440b-4d44-9042-47a673bcb52c",
"timestamp": 1783210653331
},
{
"data": {
"nodeType": "trigger"
},
"event": "node_start",
"nodeId": "96f129c0-d1d4-4cbf-a24d-0b0cea18a229",
"timestamp": 1783210653332
},
{
"data": {
"kind": "@n8n/n8n-nodes-langchain.chatTrigger"
},
"event": "seeded",
"nodeId": "trigger",
"timestamp": 1783210653332
},
{
"data": {
"status": "ok",
"nodeType": "trigger"
},
"event": "node_end",
"nodeId": "96f129c0-d1d4-4cbf-a24d-0b0cea18a229",
"timestamp": 1783210653332
},
{
"data": {
"nodeType": "manualTrigger"
},
"event": "node_start",
"nodeId": "c8ac730a-04ee-499d-b845-1149967d6aa2",
"timestamp": 1783210653334
},
{
"data": {
"initialData": {
"data": null,
"query": null,
"action": "generate_sql",
"output": null,
"schema": "CREATE TABLE users (\n user_id INT AUTO_INCREMENT PRIMARY KEY,\n username VARCHAR(50) NOT NULL UNIQUE,\n email VARCHAR(100) NOT NULL UNIQUE,\n registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n\nCREATE TABLE products (\n product_id INT AUTO_INCREMENT PRIMARY KEY,\n product_name VARCHAR(100) NOT NULL,\n description TEXT,\n price DECIMAL(10, 2) NOT NULL,\n stock_quantity INT NOT NULL\n);\n\nCREATE TABLE orders (\n order_id INT AUTO_INCREMENT PRIMARY KEY,\n user_id INT,\n order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n total_amount DECIMAL(10, 2),\n status ENUM('pending', 'processing', 'shipped', 'delivered', 'cancelled') DEFAULT 'pending',\n FOREIGN KEY (user_id) REFERENCES users(user_id)\n);\n\nCREATE TABLE order_items (\n order_item_id INT AUTO_INCREMENT PRIMARY KEY,\n order_id INT,\n product_id INT,\n quantity INT NOT NULL,\n price_at_order DECIMAL(10, 2) NOT NULL,\n FOREIGN KEY (order_id) REFERENCES orders(order_id),\n FOREIGN KEY (product_id) REFERENCES products(product_id)\n);",
"chatInput": "Show me all users who registered in the last month and their total order amounts.",
"sessionId": "session_12345",
"sqloutput": null,
"output.match": null,
"Tables_in_tttytdb2023": [
"users",
"products",
"orders",
"order_items"
]
}
},
"event": "triggered",
"nodeId": "manualTrigger",
"timestamp": 1783210653334
},
{
"data": {
"status": "ok",
"nodeType": "manualTrigger"
},
"event": "node_end",
"nodeId": "c8ac730a-04ee-499d-b845-1149967d6aa2",
"timestamp": 1783210653334
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "e4045e33-bb87-488d-8ccf-b4a94339a841",
"timestamp": 1783210653335
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210653335
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "e4045e33-bb87-488d-8ccf-b4a94339a841",
"timestamp": 1783210653335
},
{
"data": {
"nodeType": "integration"
},
"event": "node_start",
"nodeId": "4c141ae8-d2d1-45c7-bb5d-f33841d3cee6",
"timestamp": 1783210653337
},
{
"data": {
"mode": "write",
"status": "ok",
"service": "mysql",
"safeMode": true,
"latencyMs": 180,
"operation": "executeQuery",
"simulated": true
},
"event": "integration_mocked",
"nodeId": "integration",
"timestamp": 1783210653517
},
{
"data": {
"status": "ok",
"nodeType": "integration"
},
"event": "node_end",
"nodeId": "4c141ae8-d2d1-45c7-bb5d-f33841d3cee6",
"timestamp": 1783210653517
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "04511c4f-44fa-4c23-87af-54d959e6cb2c",
"timestamp": 1783210653518
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210653518
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "04511c4f-44fa-4c23-87af-54d959e6cb2c",
"timestamp": 1783210653518
},
{
"data": {
"nodeType": "integration"
},
"event": "node_start",
"nodeId": "54fb3362-041b-4e4f-bfea-f0bc788d8dfd",
"timestamp": 1783210653519
},
{
"data": {
"mode": "write",
"status": "ok",
"service": "mysql",
"safeMode": true,
"latencyMs": 180,
"operation": "executeQuery",
"simulated": true
},
"event": "integration_mocked",
"nodeId": "integration",
"timestamp": 1783210653700
},
{
"data": {
"status": "ok",
"nodeType": "integration"
},
"event": "node_end",
"nodeId": "54fb3362-041b-4e4f-bfea-f0bc788d8dfd",
"timestamp": 1783210653700
},
{
"data": {
"nodeType": "set"
},
"event": "node_start",
"nodeId": "0cd425db-2a8e-4f48-b749-9a082e948395",
"timestamp": 1783210653702
},
{
"data": {
"inputKeys": [
"Tables_in_tttytdb2023",
"schema",
"chatInput",
"sessionId",
"action",
"data",
"output.match",
"query",
"output",
"sqloutput"
],
"mergeKeys": []
},
"event": "merged",
"nodeId": "set",
"timestamp": 1783210653702
},
{
"data": {
"status": "ok",
"nodeType": "set"
},
"event": "node_end",
"nodeId": "0cd425db-2a8e-4f48-b749-9a082e948395",
"timestamp": 1783210653702
},
{
"data": {
"nodeType": "set"
},
"event": "node_start",
"nodeId": "d55e841d-11ed-4ce2-8c8e-840bd807ff2c",
"timestamp": 1783210653703
},
{
"data": {
"inputKeys": [
"ok",
"id",
"simulated",
"echo"
],
"mergeKeys": []
},
"event": "merged",
"nodeId": "set",
"timestamp": 1783210653703
},
{
"data": {
"status": "ok",
"nodeType": "set"
},
"event": "node_end",
"nodeId": "d55e841d-11ed-4ce2-8c8e-840bd807ff2c",
"timestamp": 1783210653703
},
{
"data": {
"nodeType": "llm"
},
"event": "node_start",
"nodeId": "4d993ed9-3bbe-4bc3-9e5b-c3d738b0e714",
"timestamp": 1783210653705
},
{
"data": {
"messages": 2,
"maxTokens": 1024
},
"event": "calling openai/gpt-4o-mini",
"nodeId": "llm",
"timestamp": 1783210653705
},
{
"data": {
"model": "gpt-4o-mini",
"provider": "openai"
},
"event": "llm_call",
"nodeId": "_context",
"timestamp": 1783210653705
},
{
"data": {
"model": "gemini-3-flash-preview",
"costUsd": 0.0009041,
"provider": "openai",
"latencyMs": 2315,
"promptTokens": 297,
"completionTokens": 326
},
"event": "llm_result",
"nodeId": "_context",
"timestamp": 1783210656020
},
{
"data": {
"status": "ok",
"nodeType": "llm"
},
"event": "node_end",
"nodeId": "4d993ed9-3bbe-4bc3-9e5b-c3d738b0e714",
"timestamp": 1783210656020
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "ca8d30d6-c1f1-4e89-8cd5-ea3648dc3b0c",
"timestamp": 1783210656022
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210656022
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "ca8d30d6-c1f1-4e89-8cd5-ea3648dc3b0c",
"timestamp": 1783210656022
},
{
"data": {
"nodeType": "set"
},
"event": "node_start",
"nodeId": "367ebe95-0b87-44f6-8392-33fe65446c24",
"timestamp": 1783210656023
},
{
"data": {
"inputKeys": [
"text",
"model",
"usage"
],
"mergeKeys": []
},
"event": "merged",
"nodeId": "set",
"timestamp": 1783210656023
},
{
"data": {
"status": "ok",
"nodeType": "set"
},
"event": "node_end",
"nodeId": "367ebe95-0b87-44f6-8392-33fe65446c24",
"timestamp": 1783210656023
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "2d89f901-d4e7-4fea-bd69-20b518280bbc",
"timestamp": 1783210656024
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210656024
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "2d89f901-d4e7-4fea-bd69-20b518280bbc",
"timestamp": 1783210656024
},
{
"data": {
"nodeType": "if"
},
"event": "node_start",
"nodeId": "b856fe78-2435-4075-97f8-ecbeecf3e780",
"timestamp": 1783210656025
},
{
"event": "true branch",
"nodeId": "if",
"timestamp": 1783210656025
},
{
"data": {
"status": "ok",
"nodeType": "if"
},
"event": "node_end",
"nodeId": "b856fe78-2435-4075-97f8-ecbeecf3e780",
"timestamp": 1783210656025
},
{
"data": {
"nodeType": "integration"
},
"event": "node_start",
"nodeId": "d958de24-84ef-4928-a7f3-32cada09a0eb",
"timestamp": 1783210656027
},
{
"data": {
"mode": "write",
"status": "ok",
"service": "mysql",
"safeMode": true,
"latencyMs": 180,
"operation": "executeQuery",
"simulated": true
},
"event": "integration_mocked",
"nodeId": "integration",
"timestamp": 1783210656208
},
{
"data": {
"status": "ok",
"nodeType": "integration"
},
"event": "node_end",
"nodeId": "d958de24-84ef-4928-a7f3-32cada09a0eb",
"timestamp": 1783210656208
},
{
"data": {
"nodeType": "passthrough"
},
"event": "node_start",
"nodeId": "c6e9c0e2-d238-4f0b-a4c8-2271f2c8b31b",
"timestamp": 1783210656209
},
{
"data": {},
"event": "noOp",
"nodeId": "passthrough",
"timestamp": 1783210656209
},
{
"data": {
"status": "ok",
"nodeType": "passthrough"
},
"event": "node_end",
"nodeId": "c6e9c0e2-d238-4f0b-a4c8-2271f2c8b31b",
"timestamp": 1783210656209
},
{
"data": {
"nodeType": "set"
},
"event": "node_start",
"nodeId": "cbb6d1e1-0a75-4b3a-89cd-6bd545b8d414",
"timestamp": 1783210656210
},
{
"data": {
"inputKeys": [
"ok",
"id",
"simulated",
"echo"
],
"mergeKeys": []
},
"event": "merged",
"nodeId": "set",
"timestamp": 1783210656210
},
{
"data": {
"status": "ok",
"nodeType": "set"
},
"event": "node_end",
"nodeId": "cbb6d1e1-0a75-4b3a-89cd-6bd545b8d414",
"timestamp": 1783210656210
},
{
"data": {
"nodeType": "merge"
},
"event": "node_start",
"nodeId": "9380c2f6-15d9-43e4-80a2-3019bcf5ae04",
"timestamp": 1783210656212
},
{
"data": {
"inputCount": 2
},
"event": "merged 2 inputs",
"nodeId": "merge",
"timestamp": 1783210656212
},
{
"data": {
"status": "ok",
"nodeType": "merge"
},
"event": "node_end",
"nodeId": "9380c2f6-15d9-43e4-80a2-3019bcf5ae04",
"timestamp": 1783210656212
},
{
"data": {
"nodeType": "set"
},
"event": "node_start",
"nodeId": "99a6dc03-1035-4866-81e4-11dc66bf98ec",
"timestamp": 1783210656213
},
{
"data": {
"inputKeys": [
"ok",
"id",
"simulated",
"echo",
"text",
"model",
"usage"
],
"mergeKeys": []
},
"event": "merged",
"nodeId": "set",
"timestamp": 1783210656213
},
{
"data": {
"status": "ok",
"nodeType": "set"
},
"event": "node_end",
"nodeId": "99a6dc03-1035-4866-81e4-11dc66bf98ec",
"timestamp": 1783210656213
}
]