Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Draw SQLAlchemy DatabaseNew to Visual Studio Code? Get it now.
Draw SQLAlchemy Database

Draw SQLAlchemy Database

Axmadjon Qaxxorov

| (1) | Free
Visual database designer inside VSCode — draw tables, fields, relationships and generate SQLAlchemy models
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Draw SQLAlchemy Database

Visual database designer inside VSCode — draw tables, define fields & relationships, then generate SQLAlchemy models instantly.

Draw SQLAlchemy Database


Features

Feature Status
Infinite canvas with zoom & pan ✅
Drag-and-drop table nodes ✅
Inline field editing with type selector ✅
Visual relationship drawing ✅
.sqlmap JSON schema format ✅
Generate models.py (SQLAlchemy ORM) ✅
Export SQL DDL ✅
Import SQLite .db / .sqlite3 / .sql3 ✅
Import SQL dump .sql ✅
Schema validation ✅
Right-click context menus ✅
All SQLAlchemy column types ✅
Relationships (1:1, 1:N, N:M) ✅
Foreign keys, backref, cascade ✅
Association tables ✅
Composite PKs & check constraints ✅
SQLite / PostgreSQL / MySQL dialects ✅

Quick Start

  1. Install the extension from the VSCode marketplace
  2. Create a project: Ctrl+Shift+P → DrawSQL: Create New SQLMap Project
  3. The visual designer opens automatically
  4. Add tables with the + Table button
  5. Add fields inline on each table card
  6. Draw relationships by clicking ↔ Relation then clicking source → target
  7. Save with Ctrl+S
  8. Generate models.py with the Generate models.py button

.sqlmap Format

{
  "version": "1.0",
  "database": { "dialect": "sqlite" },
  "tables": [
    {
      "name": "user",
      "fields": [
        { "name": "id", "type": "Integer", "primary_key": true, "autoincrement": true },
        { "name": "username", "type": "String", "length": 100, "unique": true, "nullable": false }
      ],
      "relationships": [
        { "name": "posts", "type": "one_to_many", "target": "post", "backref": "owner" }
      ]
    }
  ]
}

Supported SQLAlchemy Types

Integer · BigInteger · SmallInteger · String · Text · Unicode · UnicodeText · Boolean · Date · DateTime · Time · Float · Numeric · LargeBinary · JSON · JSONB · UUID · Enum · ARRAY · Interval


Commands

Command Description
DrawSQL: Open Visual Designer Open .sqlmap in the canvas editor
DrawSQL: Create New SQLMap Project Create a new blank schema
DrawSQL: Generate SQLAlchemy models.py Generate Python ORM models
DrawSQL: Export SQL DDL Generate SQL CREATE TABLE statements
DrawSQL: Import Database → SQLMap Import .db, .sqlite3, .sql
DrawSQL: Validate SQLMap Schema Check schema for errors

Right-Click Menu

On .sqlmap files:

  • Open Visual Designer
  • Generate models.py
  • Export SQL
  • Validate schema

On .db / .sqlite3 / .sql3 / .sql files:

  • Import to SQLMap
  • Open diagram

Generated Output Example

from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship, backref, DeclarativeBase


class Base(DeclarativeBase):
    pass


class User(Base):
    __tablename__ = "user"

    id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
    username = Column(String(100), unique=True, nullable=False, index=True)
    email = Column(String(255), unique=True, nullable=False)
    created_at = Column(DateTime, default=datetime.utcnow)


class Post(Base):
    __tablename__ = "post"

    id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
    title = Column(String(500), nullable=False)
    content = Column(Text)
    owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)

    owner = relationship("User", backref=backref("posts", cascade="all, delete"))

Keyboard Shortcuts

Key Action
Ctrl+S Save schema
Escape Deselect / cancel relation mode
+ / - Zoom in / out
Ctrl+0 Reset zoom
Scroll wheel Zoom
Middle drag Pan canvas

Python CLI Tools

# Generate models.py from .sqlmap
python3 core/sqlalchemy_generator.py example/blog.sqlmap models.py

# Import SQLite database
python3 core/db_importer.py mydb.db schema.sqlmap

# Parse SQL dump
python3 core/sql_parser.py dump.sql

Developer

akhmedcodes

  • Links: beacons.ai/akhmedcodes
  • GitHub: github.com/vscode-extensions-akhmedcodes

License

MIT © akhmedcodes

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft