Skip to main content

LLM-based SQL Generation

LLM-based SQL Generation

From version 0.7.0 onwards, Parseable supports LLM-based SQL generation, leveraging the power of OpenAI's language models (LLMs). With this feature, you can use natural language to generate SQL queries for analyzing your logs effortlessly.

Getting Started

To get started with LLM-based SQL generation, follow these simple steps:

  • Obtain OpenAI API token from this link.
  • Set the P_OPENAI_API_KEY environment variable to the API token obtained in the previous step.

Once the P_OPENAI_API_KEY variable is set, Parseable will automatically detect it and provide you with a input text field in the UI where you can enter natural language queries to generate SQL.

Data Mapping to Ensure Valid SQL

To generate SQL that matches your table structure accurately, Parseable includes your table schema in the query sent to the LLM. This schema includes just th column names and their data types. This ensures that the SQL generated is valid and aligns with your table definition. No other data is shared to the LLM used.

  • The LLM only generates the SQL. It doesn't run the query until you manually hit the Run button.
  • You have the option to tweak the SQL generated further to your liking before finally running it.


In addition to supporting OpenAI, we aim to integrate with other popular LLMs, including open-source and self-hostable LLMs like LLaMa. Stay tuned for more updates!

Get Updates from Parseable

Subscribe to keep up with latest news, updates and new features on Parseable