SQL to reStructuredText Converter

Transform SQL database dumps into reStructuredText table format with grid and simple table styles for Sphinx documentation and Python projects

SQL Input

reStructuredText Output

About SQL to reStructuredText Converter

Convert SQL database dumps (CREATE TABLE and INSERT statements) to reStructuredText table format with support for grid and simple table styles. Perfect for Sphinx documentation, Python projects, ReadTheDocs, and technical writing.

Key Features

  • Grid Tables: Robust format supporting multi-line cells and complex layouts
  • Simple Tables: Clean, minimalist syntax for straightforward tables
  • Header Support: Optional header row with = separator
  • Auto-sizing Columns: Automatically calculates optimal column widths
  • Sphinx Compatible: Works seamlessly with Sphinx documentation generator
  • Smart Parsing: Extracts column names and data from SQL dumps
  • File Download: Save as .rst file

How to Use

  1. Input SQL Data: Paste your SQL CREATE TABLE and INSERT statements or upload a .sql file
  2. Select Table Style: Choose between Grid Table or Simple Table format
  3. Configure Header: Toggle header row display
  4. Copy or Download: Use the Copy or Download button to save your reStructuredText table

Table Style Options

  • Grid Table: More robust, supports multi-line cells, uses +, |, -, and = characters
  • Simple Table: Cleaner syntax, uses only = and spaces, limited to single-line cells

Example Conversion

SQL Input:

CREATE TABLE products (
  id INT,
  name VARCHAR(100),
  price DECIMAL(10,2)
);

INSERT INTO products VALUES (1, 'Laptop', 999.99);
INSERT INTO products VALUES (2, 'Mouse', 24.99);

Grid Table Output:

+----+--------+--------+
| id | name   | price  |
+====+========+========+
| 1  | Laptop | 999.99 |
+----+--------+--------+
| 2  | Mouse  | 24.99  |
+----+--------+--------+

Simple Table Output:

== ====== ======
id name   price
== ====== ======
1  Laptop 999.99
2  Mouse  24.99
== ====== ======

Common Use Cases

  • Sphinx Documentation: Generate tables for Python project documentation
  • ReadTheDocs: Create formatted tables for ReadTheDocs hosting
  • PEPs: Format tables for Python Enhancement Proposals
  • Technical Writing: Include database tables in technical documentation
  • API Documentation: Document database schemas and sample data
  • Tutorials: Show database structure in educational content
  • README Files: Add formatted tables to project README files

Sphinx Integration

The generated reStructuredText tables work seamlessly with Sphinx:

  • Compatible with all Sphinx themes
  • Supports Sphinx table directives
  • Works with sphinx-build and make html
  • Renders properly in HTML, PDF, and ePub outputs

Grid vs Simple Tables

Grid Tables:

  • More complex syntax with +, |, -, and = characters
  • Supports multi-line cells and complex layouts
  • Better for tables with varying content lengths
  • More robust and flexible

Simple Tables:

  • Cleaner, minimalist syntax
  • Uses only = and spaces
  • Limited to single-line cells
  • Better for simple, straightforward tables

Supported SQL Syntax

  • CREATE TABLE: Extracts column names for table headers
  • INSERT INTO: Parses data values for table rows
  • Data Types: Handles all SQL data types (VARCHAR, INT, DECIMAL, etc.)
  • Quoted Strings: Handles single and double quotes with proper escaping
  • NULL Values: Displays empty cells for NULL values

Privacy & Security

All conversions happen locally in your browser. Your SQL data is never uploaded to any server, ensuring complete privacy and security.