Examples
Text To SQL
JigsawStack Text to SQL example.
Introduction
In this example, we will use the Text to SQL API to query transactions records stored in an SQL database on Dzero using prompts.
Initial Steps
- Setup a JigsawStack account (if you don’t have an account already)
- Get your JigsawStack API key from here.
- [Optional] Obtain your Dzero token from here.
SQL Schema
A valid schema is passed to the
sql_schema
parameter as a string. The model uses this schema to generate an accurate SQL statement based on the given prompt. Below is an example of valid schema:
This schema was copied from the Dzero dashboard after the table was created.
How to retrieve schema
SQLite
Run this query to retrieve a schema for your SQLite database.
MySQL
PostgreSQL
After getting schema (optional)
If you are performing the operation above in node.js, you can consider the following below:
Usage
sql.ts
Find more information on Text to SQL API here
Was this page helpful?