Without issues is tricky. Since it’s AI, it will make mistakes or hallucinate. Generally, the more expensive it is, the better it performs.
I’ve created a small example for you.
Using the Start Workflow Trigger, an example schema with an example.example table is created in the database and filled with dummy data.
Instead of the Postgres Tool, I used a Workflow Tool (which I think works better).
I explain to this tool what my table looks like and what it can do (e.g., that gender only includes male or female and what the JSON field for the address looks like).
The tool generates an SQL statement for the table, and the workflow executes it.
Then, just try chatting with it. Gemini 2.0 flash gets confused relatively quickly, but Gemini 2.0 pro seems pretty solid.
(In a production environment, you should definitely add validation and filters beforehand to catch things like TRUNCATE or DROP table and to ensure that it only makes queries for that specific table). Jailbreak prompts are becoming increasingly popular.