Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

marcelodfelman/sqlqueriesvisualizer

Repository files navigation

SQL Queries Visualizer

A powerful web-based tool for visualizing SQL query execution flow and data lineage, similar to SQLFlow by Gudusoft.

Features

  • πŸ” SQL Parser: Supports multiple SQL dialects (MySQL, PostgreSQL, SQL Server, Oracle, SQLite, MariaDB)
  • πŸ“Š Interactive Visualization: Real-time flow diagrams showing data movement
  • 🎯 Data Lineage: Track column-level dependencies and table relationships
  • ✏️ Monaco Editor: VS Code-like SQL editor with syntax highlighting
  • 🎨 Modern UI: Built with React, TypeScript, and Tailwind CSS
  • πŸ“₯ Export: Save diagrams as PNG images

Tech Stack

  • Frontend: React 18 + TypeScript
  • Build Tool: Vite
  • Visualization: React Flow
  • SQL Parser: node-sql-parser
  • Editor: Monaco Editor (VS Code's editor)
  • Styling: Tailwind CSS

Getting Started

Installation

npm install

Development

npm run dev

The application will open at http://localhost:3000

Build

npm run build

Preview Production Build

npm run preview

How It Works

  1. SQL Input: Enter your SQL query in the Monaco editor
  2. Parse: The query is parsed into an Abstract Syntax Tree (AST) using node-sql-parser
  3. Analyze: Extract tables, columns, joins, and operations from the AST
  4. Visualize: Generate an interactive flow diagram showing data movement
  5. Explore: Interact with the diagram, zoom, pan, and export

Supported SQL Operations

  • SELECT queries (with JOINs, subqueries, CTEs)
  • INSERT statements
  • UPDATE statements
  • DELETE statements
  • Multiple table operations
  • Column-level lineage tracking

Example Query

SELECT 
 u.user_id,
 u.username,
 COUNT(o.order_id) as total_orders
FROM users u
LEFT JOIN orders o ON u.user_id = o.user_id
GROUP BY u.user_id, u.username;

Architecture

src/
β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ SQLEditor.tsx # Monaco-based SQL editor
β”‚ └── FlowVisualizer.tsx # React Flow diagram renderer
β”œβ”€β”€ utils/
β”‚ β”œβ”€β”€ sqlAnalyzer.ts # SQL parsing and analysis logic
β”‚ └── flowGraphGenerator.ts # Graph generation for visualization
β”œβ”€β”€ App.tsx # Main application component
└── main.tsx # Application entry point

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Map sql queries as a flow graphic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /