dabbling

Share this post

AI2SQL

dabbling.substack.com

Discover more from dabbling

Dabbling in technology
Continue reading
Sign in

AI2SQL

Text to data insights

Gaurav
Jul 6, 2022
3
Share this post

AI2SQL

dabbling.substack.com
Share

Is AI smart enough to deliver data insights if we ask questions in plain English? AI2SQL claims to be a part of the answer.

So lets try it out!

About AI2SQL

AI2SQL can generate SQL statements out of data queries in plain English.

Under the hood it uses OpenAI libraries (GPT-3 and Codex).

OpenAI is an AI research and deployment venture. Their mission is to ensure that artificial general intelligence benefits all of humanity. OpenAI’s other project is DALl.E2. DALL·E 2 is a new AI system that can create realistic images and art from a description in natural language. Besides they have other exciting NLP functionality.

We’ll try the other functionalities some other day. Let’s get back to AI2SQL.

Use Case

WBL Bank offers credit cards and mortgages. The product managers ask a lot of questions; and the data analysts fetch the answers. Both are quite fed up of each other ! The data analysts want the product managers to self-service; the product managers say they have no tools to access the information themselves.

Let solve this using AI2SQL.

Data Structure

The back end database has the following tables:

  • customer_master

  • credit_card_master

  • credit_card_txns (transactions)

  • mortgage_master

  • mortgage_txns (transactions)

The ER diagram of the tables is below.

Setting up AI2SQL

The set-up is quite simple. Need to specify the table name, table description and the column names.

Let’s Ask Some Questions

Asking a question is easy. You just ask the question and click on “Generate SQL”.

I tried 5 questions.

Verdict

AI2SQL (or rather the underlying GPT-3 and Codex libraries) are excellent. As long as the column names are explanatory, the SQLs generated are accurate.

So what’s next

To use this as an end to end solution for WBL, we need the following additional components:

  • Connection to a back end DB

  • Actually running the query and fetching results

Juicy topics for a future post !!

3
Share this post

AI2SQL

dabbling.substack.com
Share
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Gaurav Chaturvedi
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing