NL2SQL
With the NL2SQL tool in OCI Generative AI, you can translate natural language to SQL (NL2SQL) to query federated enterprise data without moving or copying the data. Business terms are mapped to the underlying fields and joins through a semantic enrichment layer. Queries run directly in the source systems using existing permissions.
High-Level Workflow
First, you create a vector store that points to structured data in OCI Generative AI service, which the tool uses to generate SQL queries. This vector store includes a semantic store resource layer. During setup, you select when the enrichment process runs, either automatically at creation (on_create) or manually at a later time.
If you select on_create, the service enrichment runs immediately after the semantic store is created. This process extracts table and column details from the provided database and builds metadata that helps generate SQL queries. You can skip automatic enrichment and trigger it later using a separate API call (GenerateEnrichmentJob).
After enrichment completes, you can use the GenerateSqlFromNl API to convert natural language queries into SQL statements. This API only generates the SQL and doesn't run the query against the database.
NL2SQL API
You can use the following API for the NL2SQL tool:
ListEnrichmentJobsGetEnrichmentJobGenerateEnrichmentJobCancelEnrichmentJobGenerateSqlFromNl