Natural language to inspectable SQL

Conversational analysis of SAP Business One

A local AI-assisted application converts English and Arabic questions into T-SQL against a SAP Business One demo database, with queries and results available for inspection.

Prototype

Overview

A business question becomes an inspectable query

  • Input
  • Rule / logic
  • AI step
  • System
  • Human
  1. 01Input
    Ask

    A question in English or Arabic

  2. 02Rule / logic
    Discover schema

    Automatic schema discovery and relevant-table selection — e.g. OINV, INV1, OITM

  3. 03AI step
    Generate

    Local inference with Ollama, including qwen2.5-coder:7b

  4. 04System
    Query

    T-SQL against SBODemoGB on SQL Server 2022

  5. 05Human
    Inspect

    Generated SQL and returned results shown in Streamlit

The working prototype runs against SAP Business One demo data. It is not a confirmed production SAP integration.
01

The business question

Enterprise information is often locked behind schemas, reports and specialist SQL knowledge. The prototype explores how an analyst can ask a business question in natural language and inspect the database query produced to answer it.

02

Actual demo architecture

The application uses SAP Business One SBODemoGB on Microsoft SQL Server 2022 in a container. A Streamlit/Python front end uses pymssql and pandas, with local Ollama inference including qwen2.5-coder:7b. English and Arabic prompts are translated into T-SQL.

03

Schema awareness and traceability

Automatic schema discovery and relevant-table selection were developed to reduce irrelevant context. For sales analysis, the work specifically considered OINV, INV1 and OITM. Generated SQL and returned results are inspectable rather than presented only as a conversational answer.

04

Status and next boundary

This is a working prototype on demo data, not a confirmed production SAP integration. Evaluations encountered long runtimes and model/API errors. Strong read-only enforcement, per-user permissions and query-validation controls must not be assumed without code evidence. Documents, CSV and Excel files outside SAP were discussed as future integration needs; a lakehouse was considered but not built as part of this demo.

Evidence and status

Prototype

Working prototype against demo data

A working prototype, for example against demo data.

Talk to us about the problem.

Start with the workflow, your constraints and what a successful implementation should achieve.