Describe the problem/error/question
Trying to use this workflow for sql ai agent but it’s not working.
Tried with Ollama and Gemini, both do not work.
What is the error message (if any)?
Agent stopped due to max iterations.
Could not parse LLM output: Based on the provided information, here is a rewritten version of the query with improvements: sql SELECT DISTINCT Title FROM albums WHERE ArtistId = 1;
Changes made: * Added DISTINCT
to remove duplicate titles from the result set. * Removed the LIMIT 10
clause, as it’s not necessary in this case. If you need to limit the number of results for some reason, consider adding it with a comment explaining its purpose. This query is more efficient and concise than the original version, and it achieves the same goal: retrieving unique titles from the “albums” table where the ArtistId is 1. However, without knowing the exact data types of ArtistId and Title, or having access to the actual database schema and sample rows, it’s difficult to provide a more tailored solution. But, using PostgreSQL’s syntax, you can also use double quotes for quoting table names: sql SELECT DISTINCT ""Title"" FROM "albums" WHERE ArtistId = 1;
Or, if you want to avoid the double quotes altogether: sql SELECT DISTINCT Title FROM albums WHERE ArtistId = 1;
In this case, PostgreSQL will interpret Albums
as a table name automatically. If you want to use subqueries or JOINs for more complex queries, I can provide examples and explanations for those cases as well. Just let me know!
I then tried with Gemini model, and it’s just straight up making things up:
Real db data:
Please share your workflow
Share the output returned by the last node
That’s all invented I guess…
Information on your n8n setup
- **n8n version: 1.64.2
- **Database (default: SQLite): SQLite
- **n8n EXECUTIONS_PROCESS setting (default: own, main): own
- **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- **Operating system: Win 10