A comprehensive SQL Server database comparison and deployment tool with support for Azure Synapse, Entra MFA authentication, and advanced metadata extraction.
Repository: https://github.com/gwaghmar/sql-schema-compare
-
Multi-Authentication Support
- SQL Server Authentication
- Windows Authentication
- Azure Entra ID (MFA) with MSAL token flow
-
Comprehensive Metadata Extraction
- Tables (columns, data types, constraints)
- Primary Keys, Foreign Keys, Indexes
- Views, Stored Procedures, Functions
- Triggers, Users, Roles, Schemas
- Synonyms, Extended Properties
- Check Constraints, Default Constraints, Unique Constraints
- User-Defined Types, Sequences
- Temporal Tables, Partitioning
-
Advanced Comparison Engine
- Deep object comparison using DeepDiff
- Status detection: IDENTICAL, DIFFERENT, MISSING_IN_TARGET, MISSING_IN_SOURCE
- Schema filtering for focused comparisons
- Side-by-side diff viewer with color highlighting
-
Deployment Script Generation
- Phase-based deployment (Drop, Tables, Constraints, Programmability, Misc)
- ALTER TABLE support for column changes
- Transaction wrapping with rollback support
- Dependency resolution for programmability objects
- Deployment wizard with warnings and preview
-
Export & Reporting
- CSV, JSON, Excel (.xlsx), HTML, PDF exports
- Project save/load (XML format)
- Snapshot support (.snp files)
- Script folder comparison
-
Security & Quality
- SQL injection protection
- Input validation
- Secure JSON caching (no Pickle)
- Comprehensive logging
- Unit test coverage
- Windows (with UI for interactive sign-in)
- Python 3.10+
- ODBC Driver 18 for SQL Server (from Microsoft)
- SQL Server or Azure Synapse Analytics database access
- Clone the repository:
git clone <repository-url>
cd "REDGATE SQL"- Create a virtual environment:
python -m venv .venv
.venv\Scripts\Activate.ps1- Install dependencies:
cd sql_compare_tool
pip install -r requirements.txt- Run the application:
python main.pyAfter installing dependencies:
pyinstaller --onefile --noconsole --name sql-compare-tool main.pyThe executable will be in dist/sql-compare-tool.exe. Share this with teammates; they only need ODBC Driver 18 installed.
-
Launch the application
python main.py
-
Configure Source Connection
- Select authentication type (SQL Login, Windows, or Entra MFA)
- Enter server name and database
- Click "Test" to validate connection
-
Configure Target Connection
- Repeat the same process for target database
-
Run Comparison
- Click "Compare" button
- Wait for metadata extraction to complete
- Review results in the grid
-
View Differences
- Select any row in the results grid
- View side-by-side diff in the lower pane
- Use tabs to switch between SQL View and Summary View
-
Generate Deployment Script
- Click "Script Preview" button
- Review the generated SQL script
- Use deployment wizard for guided deployment
-
Export Results
- Use export buttons: CSV, JSON, Excel, HTML, PDF
- Save project for later: File โ Save Project
- Enter schema name in the filter field to compare only specific schemas
- Reduces load time for large databases
- Configure what to compare (tables, views, procs, etc.)
- Set comparison options (whitespace handling, case sensitivity)
- Configure transaction wrapping
- Set deployment phases
- Enable rollback script generation
- Save database metadata as snapshot (.snp file)
- Compare against snapshots instead of live databases
- Useful for offline comparisons
REDGATE SQL/
โโโ sql_compare_tool/
โ โโโ core/ # Core comparison logic
โ โ โโโ database.py # Database connections
โ โ โโโ metadata_extractor.py # Metadata extraction
โ โ โโโ comparator.py # Comparison engine
โ โ โโโ diff_generator.py # Diff generation
โ โ โโโ script_generator.py # Deployment scripts
โ โ โโโ snapshot.py # Snapshot management
โ โโโ gui/ # User interface
โ โ โโโ main_window.py # Main application window
โ โโโ utils/ # Utilities
โ โ โโโ config.py # Configuration management
โ โ โโโ logger.py # Logging system
โ โ โโโ project_manager.py # Project save/load
โ โ โโโ report_generator.py # Export functionality
โ โ โโโ sql_parser.py # SQL parsing utilities
โ โโโ tests/ # Unit tests
โ โโโ cache_manager.py # Cache management
โ โโโ main.py # Application entry point
โ โโโ requirements.txt # Python dependencies
โโโ config/ # Configuration files
โโโ docs/ # Documentation
โ โโโ PROGRESS.md
โ โโโ IMPROVEMENTS_SUMMARY.md
โ โโโ ERRORS_AND_SOLUTIONS.md
โ โโโ NEXT_STEPS_STATUS.md
โโโ README.md # This file
Configuration is stored in config/settings.json and includes:
- App Settings: UI theme, recent servers, auto-save
- Database Settings: Timeouts, default auth, connection pooling
- Comparison Settings: Whitespace handling, case sensitivity
- Script Generation: Transaction wrapping, rollback options
- Cache Settings: Cache retention policies
- Logging: Log levels, file retention
- Export: Default formats, output directories
Run unit tests:
cd sql_compare_tool/tests
python test_core_components.pyExpected output:
Ran 15 tests in 0.XXXs
OK
Overall Progress: 60% Complete
- Database connectivity (SQL/Windows/Entra MFA)
- Comprehensive metadata extraction
- Comparison engine with DeepDiff
- User interface with CustomTkinter
- Export functionality (CSV, JSON, Excel, HTML, PDF)
- Project save/load
- Deployment script generation
- Security improvements (SQL injection protection, secure caching)
- Logging infrastructure
- Configuration management
- Unit test suite
- Enhanced metadata extraction (temporal tables, partitions)
- Advanced diff viewer improvements
- Deployment wizard enhancements
- Performance optimizations
- CLR objects support
- UI/UX improvements
- Integration tests
- Comprehensive documentation
- CI/CD pipeline
See PROGRESS.md for detailed progress tracking.
- SQL Injection Protection: Input validation on all schema filters
- Secure Caching: JSON-based cache (no Pickle)
- Server Validation: Blocks dangerous characters in server names
- Token Management: Secure MSAL token caching
- PROGRESS.md - Development progress and roadmap
- IMPROVEMENTS_SUMMARY.md - Recent improvements and security fixes
- ERRORS_AND_SOLUTIONS.md - Error log and solutions
- NEXT_STEPS_STATUS.md - Implementation status
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Dependency graph is heuristic (text-based) and may need hardening
- Deployment wizard is basic (3 steps, no live execution UI)
- Test coverage at 15% (needs expansion)
- Connection pooling for better performance
- Result pagination for large comparisons
- Live deployment execution UI
- Enhanced dependency resolution
- Telemetry for error tracking
- Multi-threading for database operations
For issues, questions, or contributions:
- Review documentation in
docs/folder - Check logs in
logs/directory - Review ERRORS_AND_SOLUTIONS.md for known issues
This is a desktop application (not web-deployed). Users install and run locally on Windows machines.
Installation Requirements:
- Windows 10/11
- Python 3.10+
- ODBC Driver 18 for SQL Server
- SQL Server or Azure Synapse Analytics access
Last Updated: January 2026
Version: 1.0.0
Status: Active Development (60% Complete)