Author of the package here. That's pretty much what this package does just with optimization around what context gets sent to the LLM about the database:
https://github.com/vanna-ai/vanna/blob/main/src/vanna/base/b...
And then of course once you have the SQL, you can put it in an interface where you the SQL can be run automatically and then get a chart etc.