Skip to content

Repository files navigation

Dynamic

Dynamic is a chat-based AI SQL assistant that can connect to any PostgreSQL database, understand its schema context, and generate accurate SQL queries from natural language.

Overview

In each new agent chat, users can attach a PostgreSQL database. Dynamic then:

  1. Reads and contextualizes the database schema
  2. Vectorizes schema information for semantic retrieval
  3. Uses schema-aware context to generate accurate SQL queries
  4. Executes the query and returns the results to the user

This makes it easier to ask data questions in plain language while keeping queries grounded in the real structure of your database.

Core Workflow

  • Database attachment: User provides PostgreSQL connection details in chat.
  • Schema understanding: The app extracts schema metadata and prepares contextual documents.
  • Vectorization: Schema sections are embedded and stored in a vector store (Qdrant).
  • Retrieval + generation: Relevant schema context is retrieved at query time to guide SQL generation.
  • Execution + response: Generated SQL is run against PostgreSQL and results are returned in chat.

Tech Stack

  • Frontend / App: Next.js + TypeScript
  • Database: PostgreSQL
  • Vector Database: Qdrant
  • Embeddings: Ollama (nomic-embed-text)

Getting Started

Install dependencies and run the app:

npm install
npm run dev

Open http://localhost:3000 in your browser.

Schema Vectorization Setup

Schema vectorization scripts are available under src/scripts.

See:

  • src/scripts/README.md

Typical setup includes:

  1. Start Ollama with nomic-embed-text
  2. Start Qdrant
  3. Run vectorization script:
npx tsx src/scripts/vectorize-schema.ts

Project Goals

  • Improve SQL accuracy for natural language questions
  • Reduce hallucinated table/column usage
  • Make database exploration easier for non-SQL users
  • Provide reliable, explainable query generation based on schema context

Notes

This repository is actively evolving. As the architecture grows, this README can be expanded with:

  • Connection/security model
  • Query safety/validation strategy
  • Supported SQL operations
  • Deployment instructions

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages