import { JigsawStack } from "jigsawstack";
const jigsaw = JigsawStack({ apiKey: "your-api-key" });
const response = await jigsaw.text_to_sql({
"database": "postgresql",
"prompt": "Find all transactions with amounts exceeding $10,000, sorted by transaction date",
"sql_schema": "\n CREATE TABLE Transactions (\n transaction_id INT PRIMARY KEY, \n user_id INT NOT NULL,\n total_amount DECIMAL(10, 2) NOT NULL, \n transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n status VARCHAR(20) DEFAULT 'pending',\n FOREIGN KEY(user_id) REFERENCES Users(user_id)\n )\n "
})