Abstract: The rapid development of natural language models, especially Large Language Models (LLMs), has presented numerous possibilities for various fields. One of the most common applications is using LLMs for coding. For instance, OpenAI’s chatGPT, Anthropic Claude, Meta’s Code LLAMA, and Google Gemini are LLMs that offer state-of-the-art natural language to code generators.
One potential use case is a natural language to SQL code generator, which could assist non-technical professionals with simple data requests and enable the data teams to focus on more data-intensive tasks. This tutorial focuses on setting up a language to SQL code generator using the LLM API.
In this workshop, we will review the steps of setting up a system that enables users to interact with databases and ask questions using natural language. We will start with system design and implement this process with Python.
By the end of this session, you will:
- Understand how LLMs can be used to bridge the gap between natural language and structured data queries
- Learn how to set up prompts for creating SQL code
- Learn how to functionalize and connect the code generator with an SQL database
Session Outline:
(1) Problem statement - we will start with the motivation for setting up a SQL code generator, review different use cases, and introduce a general system design.
Learning objectives:
- Learners will understand the use cases of using LLMs to create language to SQL code generator
- Learners will review the general system design
(2) Prompt engineering - review the foundation of prompt engineering and how to set templates for creating SQL code
Learning objectives:
- Learners will understand how to interact with LLM using prompt
- Learners will learn the level of prompt context required to improve the quality of the results
(3) Functionlize the process - connect all the dots and set up a Python function that receives questions, sets up prompts, and sends a GET request to the LLM to generate SQL code and use the code to query the database.
- Learning objectives:
- Learners will understand how to functionalize the process and see a real-life example
This workshop is based on the following repository:
https://github.com/RamiKrispin/lang2sql
Background Knowledge:
Basic Python and SQL knowledge is required
In this session, we will use Python and the following libraries:
Pandas - to process the data
DuckDB - to query the data
openai - to send prompts to the OpenAI API
Bio: Rami Krispin is a senior data science and engineering manager, Docker Captain, and LinkedIn Learning instructor. He mainly focuses on time series analysis, forecasting, and MLOps applications.
He is passionate about open source, working with data, machine learning, and putting stuff into production. He creates content about MLOps and recently released a course - Data Pipeline Automation with GitHub Actions Using R and Python, on LinkedIn Learning, and multiple tutorials about Docker for data science.
He is the author of Hands-On Time Series Analysis with R and is currently working on my next book, Applied Time Series Analysis and Forecasting, which focuses on forecasting at scale with Python.

Rami Krispin
Title
Senior Manager - Data Science and Engineering | Apple


