pypgsvg


Namepypgsvg JSON
Version 1.1.38 PyPI version JSON
download
home_pageNone
SummaryGenerate SVG Entity Relationship Diagrams from PostgreSQL database dump files
upload_time2025-09-16 16:37:57
maintainerNone
docs_urlNone
authorblackburnd@gmail.com
requires_python>=3.8
licenseMIT License Copyright (c) 2025 blackburnd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords postgresql database erd diagram svg graphviz schema visualization
VCS
bugtrack_url
requirements graphviz
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pypgsvg - Lightweight PostgreSQL ERD Generator

`pypgsvg` is a **lightweight** Python tool that generates a JS/CSS/SVG interactive Entity Relationship Diagrams (ERDs) from PostgreSQL schema dump files. With **only Graphviz as a dependency**, manually run or place in CI/CD pipelines, fast rapid deployment verification scenarios.



## πŸ“¦ Installation

**Lightweight setup - only 2 steps:**

1. Install `pypgsvg`:
   ```bash
   pip install pypgsvg
   ```

2. Install Graphviz (external dependency):
   - **macOS**: `brew install graphviz`
   - **Ubuntu/Debian**: `sudo apt-get install graphviz`
   - **CentOS/RHEL**: `sudo yum install graphviz`
   - **Windows**: Download from [Graphviz.org](https://graphviz.org/download/)

**That's it!** Ready for  deployment.

---


### 🎬 Quick Demo

[[🎯 View Interactive Example](https://www.blackburnsystems.com/demo-erd-complex)] 

![](https://live.staticflickr.com/65535/54725569515_1a265e1695.jpg)

**Try it yourself:**
```bash
# Download sample and generate interactive ERD
wget https://github.com/blackburnd/pypgsvg/raw/main/Samples/complex_schema.dump
pypgsvg schema.dump --output demo_erd --view
```


## πŸ› οΈ Enterprise Usage

### Quick Start - Schema Analysis
```bash
# Generate interactive ERD from schema dump
pypgsvg schema.dump --output database_erd --view

# Enterprise automation (CI/CD ready)
pypgsvg Samples/complex_schema.dump --output Samples/complex_schema --rankdir LR --node-sep 4
```

### Advanced Enterprise Options
```bash
# Large schema optimization
pypgsvg Samples/complex_schema.dump --output Samples/complex_schema --rankdir LR --node-sep 4
source venv/bin/activate && python -m src.pypgsvg Samples/complex_schema.dump --node-shape=ellipse --show-standalone=false --output=./Samples/complex_schema --rankdir LR --node-sep 2 --packmode


# Custom layout for documentation
pypgsvg schema.dump --rankdir LR --fontsize 20 --node-fontsize 16 --output presentation_erd
```

## Usage
### Get Your PostgreSQL Schema
If you don't have a schema dump, generate one with `pg_dump`:

```bash
# Standard schema export (most common)
pg_dump -h your-host -d database -U username -s --no-owner --no-privileges > schema.dump

# Comprehensive export with triggers and functions
pg_dump -h your-host -d database -U username -s -O -F plain --disable-triggers --encoding=UTF8 > schema.dump
```

Or use our [sample schema](https://github.com/blackburnd/pypgsvg/blob/main/Samples/complex_schema.dump) for testing.

### Interactive ERD Generation

**Basic usage:**
```bash
pypgsvg schema.dump --output my_database_erd --view
```

**Usage:**
```bash
pypgsvg schema.dump \
  --output docs/database_architecture \
  --rankdir TB \
  --node-sep 4 \
  --packmode graph \
  --rank-sep 3 \
  --hide-standalone
```

**The generated SVG includes:**
- πŸ–±οΈ **Interactive selection** - Click tables/edges to view SQL details
- πŸ“± **Miniature navigator** - Overview panel for large schemas  
- πŸ“‹ **Copy/download tools** - Export selected elements
- 🎨 **Resizable panels** - Customize your workspace
- ⌨️ **Keyboard shortcuts** - ESC/R to reset view

> **Note:** For full interactivity, open the SVG file locally in your browser. GitHub restricts JavaScript for security.


### Scriptable API

Perfect for automation and enterprise workflows:

```python
from pypgsvg import parse_sql_dump, generate_erd_with_graphviz

# Parse schema dump
with open("schema.dump", "r", encoding='utf-8') as file:
    sql_content = file.read()

# Extract database structure  
tables, foreign_keys, triggers, errors = parse_sql_dump(sql_content)

# Generate interactive ERD
if not errors:
    generate_erd_with_graphviz(
        tables=tables,
        foreign_keys=foreign_keys, 
        output_file="enterprise_diagram",
        rankdir='TB',
        packmode='graph'
    )
    print("βœ… Enterprise ERD generated successfully!")
else:
    print("⚠️ Parsing errors:", errors)
```

---

## βš™οΈ Complete Command-Line Reference

### Core Arguments

| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `input_file` | **Required** | - | Path to the PostgreSQL dump file |
| `-o, --output` | String | `schema_erd` | Output file name (without extension) |
| `--view` | Flag | `false` | Open the generated SVG in a browser |
| `--show-standalone` | String | `true` | Show/hide tables with no foreign key relationships |

### Layout & Positioning

| Argument | Type | Default | Options | Description |
|----------|------|---------|---------|-------------|
| `--packmode` | String | `array` | `array`, `cluster`, `graph` | **Graphviz packmode** - Controls how components are packed together |
| `--rankdir` | String | `TB` | `TB`, `LR`, `BT`, `RL` | **Graphviz rankdir** - Graph direction (Top-Bottom, Left-Right, etc.) |
| `--esep` | String | `8` | Any number | **Graphviz esep** - Edge separation distance in points |
| `--node-sep` | String | `0.5` | Any number | **Graphviz nodesep** - Minimum distance between nodes |
| `--rank-sep` | String | `1.2` | Any number | **Graphviz ranksep** - Distance between ranks/levels |

### Typography & Styling

| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `--fontname` | String | `Arial` | Font family for all text elements |
| `--fontsize` | Integer | `18` | Font size for graph title/labels |
| `--node-fontsize` | Integer | `14` | Font size for table names and column text |
| `--edge-fontsize` | Integer | `12` | Font size for relationship labels |
| `--node-style` | String | `rounded,filled` | **Graphviz node style** (e.g., `filled`, `rounded,filled`) |
| `--node-shape` | String | `rect` | **Graphviz node shape** (e.g., `rect`, `ellipse`, `box`) |

### Color & Visual Enhancement

| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `--saturate` | Float | `1.8` | Color saturation multiplier for table backgrounds |
| `--brightness` | Float | `1.0` | Brightness adjustment for table colors |



### Understanding Graphviz Parameters

#### Packmode Options
- **`array`** (default): Tables arranged in a regular grid pattern
- **`cluster`**: Groups related tables together spatially  
- **`graph`**: Optimizes overall graph layout, best for complex schemas

#### Rankdir Options
- **`TB`** (Top-Bottom): Traditional vertical flow, tables flow downward
- **`LR`** (Left-Right): Horizontal flow, good for wide displays
- **`BT`** (Bottom-Top): Reverse vertical flow
- **`RL`** (Right-Left): Reverse horizontal flow

#### Distance Parameters
- **`esep`**: Controls spacing between edges (relationship lines)
- **`node-sep`**: Minimum distance between table nodes
- **`rank-sep`**: Distance between different levels/ranks of tables

### Advanced Filtering

Tables are automatically excluded based on common patterns:

- **Views**: `vw_*`, `*_view`
- **Temporary**: `*_temp`, `*_tmp`, `temp_*`
- **Backup**: `*_bk`, `*_backup`, `*_old`
- **Audit/Log**: `*_log`, `*_audit`, `audit_*`
- **Duplicates**: `*_dups`, `*_duplicates`
- **Archives**: `*_archive`, `archive_*`

Use `--show-standalone false` to hide tables with no foreign key relationships.

---

## 🎯 Interactive Components

The generated SVG includes several interactive panels that can be moved, resized, and minimized:
### πŸ“Š Metadata Panel
Displays comprehensive information about your database schema:
- **Schema statistics** (table count, columns, relationships)
- **Generation parameters** used
- **File information** and timestamps
- **Interactive controls** (minimize, close, drag to reposition)

[![Metadata Panel](https://live.staticflickr.com/65535/54725445018_efd3631f59.jpg)](https://flic.kr/s/aHBqjCpNX1)

### πŸ—ΊοΈ Miniature Overview
Navigate large schemas effortlessly:
- **Interactive minimap** with viewport indicator
- **Click to jump** to specific schema areas
- **Drag viewport** for precise navigation
- **Resizable panel** - make it larger for detailed navigation

[![Overview Panel](https://live.staticflickr.com/65535/54725569515_1a265e1695.jpg)](https://flic.kr/s/aHBqjCpNX1)

### πŸ” Selection Details
View and export detailed SQL information:
- **Table definitions** with column details and constraints
- **Foreign key relationships** with full SQL syntax
- **Trigger information** including execution details
- **Copy button** for instant clipboard access
- **Download button** for formatted text export
- **Enterprise-friendly** emoji-free output option

[![Selection Panel](https://live.staticflickr.com/65535/54725469434_1300a2e147.jpg)](https://flic.kr/s/aHBqjCpNX1)
**Example selection output:**
```
πŸ“Š Selected Tables
==================
public_franchises
public_association_map
public_ecommerce
...

πŸ”— Foreign Key Relationships  
============================
πŸ”‘ franchise_id β†’ id
ALTER TABLE ONLY public.association_map
    ADD CONSTRAINT association_map_franchise_id_fkey 
    FOREIGN KEY (franchise_id) REFERENCES public.franchises(id) 
    ON DELETE CASCADE;
```

---


For detailed testing instructions, see the [Testing Guide](docs/testing-guide.md).

**Quality metrics:**
- βœ… **95%+ code coverage** 
- βœ… **70+ comprehensive tests**
- βœ… **Cross-platform compatibility**

---

## πŸ—οΈ Architecture & Performance

### Lightweight Design
```text
πŸ“¦ pypgsvg/
β”œβ”€β”€ 🐍 Pure Python core (~450 lines)
β”œβ”€β”€ 🎨 CSS styling (~200 lines)  
β”œβ”€β”€ ⚑ JavaScript interactivity (~2000 lines)
β”œβ”€β”€ πŸ§ͺ Comprehensive tests (~1000+ lines)
└── πŸ“š Zero runtime dependencies (except Graphviz)
```

**Performance characteristics:**
- **Fast parsing** - Processes large schemas in seconds
- **Memory efficient** - Minimal footprint for enterprise deployment
- **Scalable output** - Handles schemas with hundreds of tables
- **Quick startup** - No database connections or heavy frameworks

### Enterprise-Ready Features
- **πŸ”’ Security-focused** - No network requirements, processes local files only
- **πŸ“‹ Audit-friendly** - Deterministic output for version control
- **πŸš€ Container-ready** - Minimal Docker image size
- **βš™οΈ Configurable** - Extensive customization options
- **πŸ“Š Monitoring** - Built-in error reporting and validation

---

## βš™οΈ Configuration & Customization

### Advanced Layout Options
```bash
# Horizontal layout for wide displays
pypgsvg schema.dump --rankdir LR --node-sep 3 --rank-sep 2

# Compact layout for presentations  
pypgsvg schema.dump --packmode graph --fontsize 16 --node-fontsize 14

# Large schema optimization
pypgsvg schema.dump --hide-standalone --esep 8 --rank-sep 4
```

### Table Filtering (Automatic)
Enterprise-focused exclusions for cleaner diagrams:
- **Views** (`vw_*`) - Database views  
- **Backup tables** (`*_bk`, `*_backup`) - Temporary backup data
- **Utility tables** (`*_temp`, `*_tmp`) - Temporary processing tables
- **Log tables** (`*_log`, `*_audit`) - Audit and logging tables
- **Duplicate tables** (`*_dups`, `*_duplicates`) - Data cleanup tables
- **Version tables** (`*_old`, `*_archive`) - Historical data tables

### Color & Accessibility
- **WCAG-compliant** color palette with proper contrast ratios
- **Automatic text color** calculation for readability
- **Color-blind friendly** palette selection
- **High-contrast mode** for professional presentations

---


---

## 🚨 Error Handling & Reliability

**Error management:**
- **Graceful degradation** - Continues processing despite individual parsing errors
- **Detailed error reporting** - Specific line numbers and context
- **Encoding resilience** - Handles various character encodings
- **Malformed SQL recovery** - Attempts to extract partial information
- **Validation checks** - Ensures output integrity

**Logging:**
```python
# Built-in error collection for monitoring
tables, foreign_keys, triggers, errors = parse_sql_dump(sql_content)

if errors:
    for error in errors:
        log.warning(f"Schema parsing issue: {error}")
    # Continue with partial results
```

---

## 🀝 Contributing
Welcome users and contributors:

1. **Code quality** - Follow PEP 8 and maintain >95% test coverage
2. **Enterprise focus** - Consider automation and deployment scenarios  
3. **Performance** - Optimize for large schemas and CI/CD usage
4. **Documentation** - Update examples for enterprise use cases
5. **Testing** - Add tests for new SQL patterns and edge cases

---

### Required
- **Python 3.8+** (standard in most enterprise environments)
- **Graphviz** (system package, widely available)

### Development/Testing Only
- `pytest>=7.0.0` - Testing framework
- `pytest-cov>=4.0.0` - Coverage reporting  

## Testing

The project includes both unit tests (Python) and functional tests (browser-based).

### Quick Start
Use the provided test runner script which handles environment setup:

```bash
# Run unit tests
./run-tests.sh

# Run browser tests
./run-tests.sh --browser
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypgsvg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "postgresql, database, erd, diagram, svg, graphviz, schema, visualization",
    "author": "blackburnd@gmail.com",
    "author_email": "Daniel Blackburn <blackburnd@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8c/2c/7758de483f0ed836f707c608eb4395d6e87912b3fb815e9de5971444a5cd/pypgsvg-1.1.38.tar.gz",
    "platform": null,
    "description": "# pypgsvg - Lightweight PostgreSQL ERD Generator\n\n`pypgsvg` is a **lightweight** Python tool that generates a JS/CSS/SVG interactive Entity Relationship Diagrams (ERDs) from PostgreSQL schema dump files. With **only Graphviz as a dependency**, manually run or place in CI/CD pipelines, fast rapid deployment verification scenarios.\n\n\n\n## \ud83d\udce6 Installation\n\n**Lightweight setup - only 2 steps:**\n\n1. Install `pypgsvg`:\n   ```bash\n   pip install pypgsvg\n   ```\n\n2. Install Graphviz (external dependency):\n   - **macOS**: `brew install graphviz`\n   - **Ubuntu/Debian**: `sudo apt-get install graphviz`\n   - **CentOS/RHEL**: `sudo yum install graphviz`\n   - **Windows**: Download from [Graphviz.org](https://graphviz.org/download/)\n\n**That's it!** Ready for  deployment.\n\n---\n\n\n### \ud83c\udfac Quick Demo\n\n[[\ud83c\udfaf View Interactive Example](https://www.blackburnsystems.com/demo-erd-complex)] \n\n![](https://live.staticflickr.com/65535/54725569515_1a265e1695.jpg)\n\n**Try it yourself:**\n```bash\n# Download sample and generate interactive ERD\nwget https://github.com/blackburnd/pypgsvg/raw/main/Samples/complex_schema.dump\npypgsvg schema.dump --output demo_erd --view\n```\n\n\n## \ud83d\udee0\ufe0f Enterprise Usage\n\n### Quick Start - Schema Analysis\n```bash\n# Generate interactive ERD from schema dump\npypgsvg schema.dump --output database_erd --view\n\n# Enterprise automation (CI/CD ready)\npypgsvg Samples/complex_schema.dump --output Samples/complex_schema --rankdir LR --node-sep 4\n```\n\n### Advanced Enterprise Options\n```bash\n# Large schema optimization\npypgsvg Samples/complex_schema.dump --output Samples/complex_schema --rankdir LR --node-sep 4\nsource venv/bin/activate && python -m src.pypgsvg Samples/complex_schema.dump --node-shape=ellipse --show-standalone=false --output=./Samples/complex_schema --rankdir LR --node-sep 2 --packmode\n\n\n# Custom layout for documentation\npypgsvg schema.dump --rankdir LR --fontsize 20 --node-fontsize 16 --output presentation_erd\n```\n\n## Usage\n### Get Your PostgreSQL Schema\nIf you don't have a schema dump, generate one with `pg_dump`:\n\n```bash\n# Standard schema export (most common)\npg_dump -h your-host -d database -U username -s --no-owner --no-privileges > schema.dump\n\n# Comprehensive export with triggers and functions\npg_dump -h your-host -d database -U username -s -O -F plain --disable-triggers --encoding=UTF8 > schema.dump\n```\n\nOr use our [sample schema](https://github.com/blackburnd/pypgsvg/blob/main/Samples/complex_schema.dump) for testing.\n\n### Interactive ERD Generation\n\n**Basic usage:**\n```bash\npypgsvg schema.dump --output my_database_erd --view\n```\n\n**Usage:**\n```bash\npypgsvg schema.dump \\\n  --output docs/database_architecture \\\n  --rankdir TB \\\n  --node-sep 4 \\\n  --packmode graph \\\n  --rank-sep 3 \\\n  --hide-standalone\n```\n\n**The generated SVG includes:**\n- \ud83d\uddb1\ufe0f **Interactive selection** - Click tables/edges to view SQL details\n- \ud83d\udcf1 **Miniature navigator** - Overview panel for large schemas  \n- \ud83d\udccb **Copy/download tools** - Export selected elements\n- \ud83c\udfa8 **Resizable panels** - Customize your workspace\n- \u2328\ufe0f **Keyboard shortcuts** - ESC/R to reset view\n\n> **Note:** For full interactivity, open the SVG file locally in your browser. GitHub restricts JavaScript for security.\n\n\n### Scriptable API\n\nPerfect for automation and enterprise workflows:\n\n```python\nfrom pypgsvg import parse_sql_dump, generate_erd_with_graphviz\n\n# Parse schema dump\nwith open(\"schema.dump\", \"r\", encoding='utf-8') as file:\n    sql_content = file.read()\n\n# Extract database structure  \ntables, foreign_keys, triggers, errors = parse_sql_dump(sql_content)\n\n# Generate interactive ERD\nif not errors:\n    generate_erd_with_graphviz(\n        tables=tables,\n        foreign_keys=foreign_keys, \n        output_file=\"enterprise_diagram\",\n        rankdir='TB',\n        packmode='graph'\n    )\n    print(\"\u2705 Enterprise ERD generated successfully!\")\nelse:\n    print(\"\u26a0\ufe0f Parsing errors:\", errors)\n```\n\n---\n\n## \u2699\ufe0f Complete Command-Line Reference\n\n### Core Arguments\n\n| Argument | Type | Default | Description |\n|----------|------|---------|-------------|\n| `input_file` | **Required** | - | Path to the PostgreSQL dump file |\n| `-o, --output` | String | `schema_erd` | Output file name (without extension) |\n| `--view` | Flag | `false` | Open the generated SVG in a browser |\n| `--show-standalone` | String | `true` | Show/hide tables with no foreign key relationships |\n\n### Layout & Positioning\n\n| Argument | Type | Default | Options | Description |\n|----------|------|---------|---------|-------------|\n| `--packmode` | String | `array` | `array`, `cluster`, `graph` | **Graphviz packmode** - Controls how components are packed together |\n| `--rankdir` | String | `TB` | `TB`, `LR`, `BT`, `RL` | **Graphviz rankdir** - Graph direction (Top-Bottom, Left-Right, etc.) |\n| `--esep` | String | `8` | Any number | **Graphviz esep** - Edge separation distance in points |\n| `--node-sep` | String | `0.5` | Any number | **Graphviz nodesep** - Minimum distance between nodes |\n| `--rank-sep` | String | `1.2` | Any number | **Graphviz ranksep** - Distance between ranks/levels |\n\n### Typography & Styling\n\n| Argument | Type | Default | Description |\n|----------|------|---------|-------------|\n| `--fontname` | String | `Arial` | Font family for all text elements |\n| `--fontsize` | Integer | `18` | Font size for graph title/labels |\n| `--node-fontsize` | Integer | `14` | Font size for table names and column text |\n| `--edge-fontsize` | Integer | `12` | Font size for relationship labels |\n| `--node-style` | String | `rounded,filled` | **Graphviz node style** (e.g., `filled`, `rounded,filled`) |\n| `--node-shape` | String | `rect` | **Graphviz node shape** (e.g., `rect`, `ellipse`, `box`) |\n\n### Color & Visual Enhancement\n\n| Argument | Type | Default | Description |\n|----------|------|---------|-------------|\n| `--saturate` | Float | `1.8` | Color saturation multiplier for table backgrounds |\n| `--brightness` | Float | `1.0` | Brightness adjustment for table colors |\n\n\n\n### Understanding Graphviz Parameters\n\n#### Packmode Options\n- **`array`** (default): Tables arranged in a regular grid pattern\n- **`cluster`**: Groups related tables together spatially  \n- **`graph`**: Optimizes overall graph layout, best for complex schemas\n\n#### Rankdir Options\n- **`TB`** (Top-Bottom): Traditional vertical flow, tables flow downward\n- **`LR`** (Left-Right): Horizontal flow, good for wide displays\n- **`BT`** (Bottom-Top): Reverse vertical flow\n- **`RL`** (Right-Left): Reverse horizontal flow\n\n#### Distance Parameters\n- **`esep`**: Controls spacing between edges (relationship lines)\n- **`node-sep`**: Minimum distance between table nodes\n- **`rank-sep`**: Distance between different levels/ranks of tables\n\n### Advanced Filtering\n\nTables are automatically excluded based on common patterns:\n\n- **Views**: `vw_*`, `*_view`\n- **Temporary**: `*_temp`, `*_tmp`, `temp_*`\n- **Backup**: `*_bk`, `*_backup`, `*_old`\n- **Audit/Log**: `*_log`, `*_audit`, `audit_*`\n- **Duplicates**: `*_dups`, `*_duplicates`\n- **Archives**: `*_archive`, `archive_*`\n\nUse `--show-standalone false` to hide tables with no foreign key relationships.\n\n---\n\n## \ud83c\udfaf Interactive Components\n\nThe generated SVG includes several interactive panels that can be moved, resized, and minimized:\n### \ud83d\udcca Metadata Panel\nDisplays comprehensive information about your database schema:\n- **Schema statistics** (table count, columns, relationships)\n- **Generation parameters** used\n- **File information** and timestamps\n- **Interactive controls** (minimize, close, drag to reposition)\n\n[![Metadata Panel](https://live.staticflickr.com/65535/54725445018_efd3631f59.jpg)](https://flic.kr/s/aHBqjCpNX1)\n\n### \ud83d\uddfa\ufe0f Miniature Overview\nNavigate large schemas effortlessly:\n- **Interactive minimap** with viewport indicator\n- **Click to jump** to specific schema areas\n- **Drag viewport** for precise navigation\n- **Resizable panel** - make it larger for detailed navigation\n\n[![Overview Panel](https://live.staticflickr.com/65535/54725569515_1a265e1695.jpg)](https://flic.kr/s/aHBqjCpNX1)\n\n### \ud83d\udd0d Selection Details\nView and export detailed SQL information:\n- **Table definitions** with column details and constraints\n- **Foreign key relationships** with full SQL syntax\n- **Trigger information** including execution details\n- **Copy button** for instant clipboard access\n- **Download button** for formatted text export\n- **Enterprise-friendly** emoji-free output option\n\n[![Selection Panel](https://live.staticflickr.com/65535/54725469434_1300a2e147.jpg)](https://flic.kr/s/aHBqjCpNX1)\n**Example selection output:**\n```\n\ud83d\udcca Selected Tables\n==================\npublic_franchises\npublic_association_map\npublic_ecommerce\n...\n\n\ud83d\udd17 Foreign Key Relationships  \n============================\n\ud83d\udd11 franchise_id \u2192 id\nALTER TABLE ONLY public.association_map\n    ADD CONSTRAINT association_map_franchise_id_fkey \n    FOREIGN KEY (franchise_id) REFERENCES public.franchises(id) \n    ON DELETE CASCADE;\n```\n\n---\n\n\nFor detailed testing instructions, see the [Testing Guide](docs/testing-guide.md).\n\n**Quality metrics:**\n- \u2705 **95%+ code coverage** \n- \u2705 **70+ comprehensive tests**\n- \u2705 **Cross-platform compatibility**\n\n---\n\n## \ud83c\udfd7\ufe0f Architecture & Performance\n\n### Lightweight Design\n```text\n\ud83d\udce6 pypgsvg/\n\u251c\u2500\u2500 \ud83d\udc0d Pure Python core (~450 lines)\n\u251c\u2500\u2500 \ud83c\udfa8 CSS styling (~200 lines)  \n\u251c\u2500\u2500 \u26a1 JavaScript interactivity (~2000 lines)\n\u251c\u2500\u2500 \ud83e\uddea Comprehensive tests (~1000+ lines)\n\u2514\u2500\u2500 \ud83d\udcda Zero runtime dependencies (except Graphviz)\n```\n\n**Performance characteristics:**\n- **Fast parsing** - Processes large schemas in seconds\n- **Memory efficient** - Minimal footprint for enterprise deployment\n- **Scalable output** - Handles schemas with hundreds of tables\n- **Quick startup** - No database connections or heavy frameworks\n\n### Enterprise-Ready Features\n- **\ud83d\udd12 Security-focused** - No network requirements, processes local files only\n- **\ud83d\udccb Audit-friendly** - Deterministic output for version control\n- **\ud83d\ude80 Container-ready** - Minimal Docker image size\n- **\u2699\ufe0f Configurable** - Extensive customization options\n- **\ud83d\udcca Monitoring** - Built-in error reporting and validation\n\n---\n\n## \u2699\ufe0f Configuration & Customization\n\n### Advanced Layout Options\n```bash\n# Horizontal layout for wide displays\npypgsvg schema.dump --rankdir LR --node-sep 3 --rank-sep 2\n\n# Compact layout for presentations  \npypgsvg schema.dump --packmode graph --fontsize 16 --node-fontsize 14\n\n# Large schema optimization\npypgsvg schema.dump --hide-standalone --esep 8 --rank-sep 4\n```\n\n### Table Filtering (Automatic)\nEnterprise-focused exclusions for cleaner diagrams:\n- **Views** (`vw_*`) - Database views  \n- **Backup tables** (`*_bk`, `*_backup`) - Temporary backup data\n- **Utility tables** (`*_temp`, `*_tmp`) - Temporary processing tables\n- **Log tables** (`*_log`, `*_audit`) - Audit and logging tables\n- **Duplicate tables** (`*_dups`, `*_duplicates`) - Data cleanup tables\n- **Version tables** (`*_old`, `*_archive`) - Historical data tables\n\n### Color & Accessibility\n- **WCAG-compliant** color palette with proper contrast ratios\n- **Automatic text color** calculation for readability\n- **Color-blind friendly** palette selection\n- **High-contrast mode** for professional presentations\n\n---\n\n\n---\n\n## \ud83d\udea8 Error Handling & Reliability\n\n**Error management:**\n- **Graceful degradation** - Continues processing despite individual parsing errors\n- **Detailed error reporting** - Specific line numbers and context\n- **Encoding resilience** - Handles various character encodings\n- **Malformed SQL recovery** - Attempts to extract partial information\n- **Validation checks** - Ensures output integrity\n\n**Logging:**\n```python\n# Built-in error collection for monitoring\ntables, foreign_keys, triggers, errors = parse_sql_dump(sql_content)\n\nif errors:\n    for error in errors:\n        log.warning(f\"Schema parsing issue: {error}\")\n    # Continue with partial results\n```\n\n---\n\n## \ud83e\udd1d Contributing\nWelcome users and contributors:\n\n1. **Code quality** - Follow PEP 8 and maintain >95% test coverage\n2. **Enterprise focus** - Consider automation and deployment scenarios  \n3. **Performance** - Optimize for large schemas and CI/CD usage\n4. **Documentation** - Update examples for enterprise use cases\n5. **Testing** - Add tests for new SQL patterns and edge cases\n\n---\n\n### Required\n- **Python 3.8+** (standard in most enterprise environments)\n- **Graphviz** (system package, widely available)\n\n### Development/Testing Only\n- `pytest>=7.0.0` - Testing framework\n- `pytest-cov>=4.0.0` - Coverage reporting  \n\n## Testing\n\nThe project includes both unit tests (Python) and functional tests (browser-based).\n\n### Quick Start\nUse the provided test runner script which handles environment setup:\n\n```bash\n# Run unit tests\n./run-tests.sh\n\n# Run browser tests\n./run-tests.sh --browser\n```\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 blackburnd\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Generate SVG Entity Relationship Diagrams from PostgreSQL database dump files",
    "version": "1.1.38",
    "project_urls": {
        "Bug Reports": "https://github.com/blackburnd/pypgsvg/issues",
        "Documentation": "https://github.com/blackburnd/pypgsvg#readme",
        "Homepage": "https://github.com/blackburnd/pypgsvg",
        "Source Code": "https://github.com/blackburnd/pypgsvg"
    },
    "split_keywords": [
        "postgresql",
        " database",
        " erd",
        " diagram",
        " svg",
        " graphviz",
        " schema",
        " visualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "74bc8f9549bebf2ddd56bd994e3f7299770098524e603ceb8aee2b4f4c82ae45",
                "md5": "72511b105f2c884876607033ab7a8226",
                "sha256": "8024e80657e8fa12b296f6dafb01e75d68264638234bc1385245820f053864fa"
            },
            "downloads": -1,
            "filename": "pypgsvg-1.1.38-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "72511b105f2c884876607033ab7a8226",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 47164,
            "upload_time": "2025-09-16T16:37:55",
            "upload_time_iso_8601": "2025-09-16T16:37:55.337312Z",
            "url": "https://files.pythonhosted.org/packages/74/bc/8f9549bebf2ddd56bd994e3f7299770098524e603ceb8aee2b4f4c82ae45/pypgsvg-1.1.38-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8c2c7758de483f0ed836f707c608eb4395d6e87912b3fb815e9de5971444a5cd",
                "md5": "7e7013cfce55f835afba46b7e759d974",
                "sha256": "bbf20e1bfe76077f1f512a3cb474e1dbc3b9403d2dba643137c615d4e001f8da"
            },
            "downloads": -1,
            "filename": "pypgsvg-1.1.38.tar.gz",
            "has_sig": false,
            "md5_digest": "7e7013cfce55f835afba46b7e759d974",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1170454,
            "upload_time": "2025-09-16T16:37:57",
            "upload_time_iso_8601": "2025-09-16T16:37:57.970494Z",
            "url": "https://files.pythonhosted.org/packages/8c/2c/7758de483f0ed836f707c608eb4395d6e87912b3fb815e9de5971444a5cd/pypgsvg-1.1.38.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-16 16:37:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blackburnd",
    "github_project": "pypgsvg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "graphviz",
            "specs": [
                [
                    ">=",
                    "0.20.0"
                ]
            ]
        }
    ],
    "lcname": "pypgsvg"
}
        
Elapsed time: 4.47470s