Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert
NOTE: The views and opinions expressed in this blog are my own


Lets jump right in with an actual question I just gave to a Hana Cloud Database:


The response I got back was correct :


Ok so you're guessing I used ChatGPT, so  it's either hallucinating and made a lucky guess, or perhaps I pre-loaded the data (context)  into ChatGPT and it just summarised the results for me.




I utilsed  OpenAI's API's to converted the question into SQL, the SQL was then executed on a Hana Cloud instance and the results were then further summarised by OpenAI.  LangChain's SQLDatabaseChain does most of the work.

Heres the full interaction:

Click to Enlarge


Bonus Points to anyone who noticed I 'deliberately' miss-spelt Australia in the question.  It wasn't a significant obstacle for OpenAI.


The SQL generated really does run in Hana:

Click to Enlarge


The data flow is approximately like this:


To test it yourself you can try on Google Colab here:




The main inspirations and references include:


sqllite examples

sqlalchemy for Hana


So as you can see it's now possible to ask Hana questions in Natural language.

I hope you found this glimpse of a potential future interesting.


In the next 2 blogs I explore some of the issues and potentials solutions of working with Large Lanaguage Models with sensitive Enterprise data:

Under the Hood – Text to SQL with LangChain, LLM’s and Hana

Into the SQL weeds - Fine-Tuning an LLM with Enterprise Data


What use case would you find this useful for?


SAP notes that posts about potential uses of generative AI and large language models are merely the individual poster's ideas and opinions, and do not represent SAP's official position or future development roadmap. SAP has no legal obligation or other commitment to pursue any course of business, or develop or release any functionality, mentioned in any post or related content on this website.