Using {{variables}} in Query SQL Database

Hi,

I’m trying to query data in the same way as the following training video, but the Query SQL Database Block is not recognizing the variable (In the video 6:55). And if run the agent, I’ll get:

{ “type”: “error”, “error”: { “message”: “syntax error at or near “```”” } }

Am I missing anything?

Hi @Aydin,

Thanks for the screenshot!

It seems like the error is coming from backtick symbols (```) being included in the generated query. Your database is throwing a syntax error because of them.

Can you try running the query directly in your database with and without the backticks? If it works without them, add an instruction to your Generate Text block to avoid including those symbols in queries.

As for the variable not being recognized, are you referring to it not turning pink? If so, this is just a UI difference and shouldn’t affect your Agent’s performance.