Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Hari-Sql-GeneratorNew to Visual Studio Code? Get it now.
Hari-Sql-Generator

Hari-Sql-Generator

Harishankar Ravindran

|
7 installs
| (1) | Free
SQL expert for Copilot Chat
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Hari SQL Generator

A VS Code extension that provides intelligent SQL query generation using GitHub Copilot Chat with real database schema context.

Features

  • Real-time Schema Access: Connects directly to your PostgreSQL database to get actual table and column information
  • Smart SQL Generation: AI generates queries based on your actual database structure
  • Query Execution: Run generated queries and see results directly in VS Code
  • Single File Workflow: Reuses the same SQL file to maintain database connections

Quick Start

1. Install & Setup

  1. Install the extension in VS Code
  2. Ensure you have GitHub Copilot Chat extension installed

2. Configure Database Connection

  • Open Command Palette (Ctrl+Shift+P)
  • Run "Configure Database Connection"
  • Choose between:
    • Connection String: postgresql://username:password@host:port/database
    • Individual Settings: Enter host, port, database, username, password separately

3. Test Connection

  • Run "Test Database Connection" command
  • Check console for connection status

4. Use the Extension

  • Open Copilot Chat
  • Type: @sql-generator show me all orders
  • Click "Run Query" to execute and see results

Example Usage

@sql-generator show me all customers from New York
@sql-generator get total sales by month
@sql-generator find orders with amount > 1000

How It Works

  1. Schema Retrieval: Extension queries your database's information_schema to get real table/column information
  2. Context Passing: Sends actual schema as context to GitHub Copilot Chat
  3. Smart Generation: AI generates SQL using your exact table names and columns
  4. Direct Execution: Runs queries against your database and displays results

Requirements

  • VS Code 1.102.0 or higher
  • GitHub Copilot Chat extension
  • PostgreSQL database (local or remote)
  • Node.js and npm (for development)

Extension Settings

This extension contributes the following settings:

  • hariSqlGenerator.postgresql.host - Database host (default: localhost)
  • hariSqlGenerator.postgresql.port - Database port (default: 5432)
  • hariSqlGenerator.postgresql.database - Database name
  • hariSqlGenerator.postgresql.username - Username
  • hariSqlGenerator.postgresql.password - Password
  • hariSqlGenerator.connectionString - Full connection string (overrides individual settings)

Development & Testing

  1. Clone the repository
  2. Run npm install
  3. Run npm run compile
  4. Press F5 to launch Extension Development Host
  5. Test the extension in the new VS Code window

Commands

  • Configure Database Connection - Set up database credentials
  • Test Database Connection - Verify connectivity
  • Run PostgreSQL Query - Execute queries with results

Architecture

Based on the proven architecture from Microsoft's copilot-pg extension, featuring:

  • Direct database connectivity using pg-promise
  • Real-time schema introspection
  • DDL format conversion for optimal AI understanding
  • Persistent connection pooling
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft