Skip to main content

A Python utility for executing SQL files against databases with support for multiple statements, comments, and pretty-printed results

Project description

splurge-sql-runner

PyPI version Python versions License: MIT

CI Coverage Ruff mypy

A robust, secure, and user-friendly Python utility for executing SQL files against databases with support for multiple statements, comments, and formatted results.

✨ Key Features

  • 🔧 Multi-Statement Execution: Process SQL files containing multiple statements
  • 🗄️ Database Agnostic: Support for SQLite, PostgreSQL, MySQL, Oracle, and more
  • 🔒 Security First: Configurable validation for SQL content and database URLs
  • 📊 Smart Output: Pretty tables, JSON format, and verbose logging
  • ⚙️ Flexible Configuration: CLI args, JSON files, and environment variables
  • 🛡️ Error Recovery: Continue processing on errors with detailed reporting

🚀 Quick Start

Installation

pip install splurge-sql-runner

Basic Usage

# Execute a single SQL file
splurge-sql-runner -c "sqlite:///database.db" -f "script.sql"

# Execute multiple SQL files using a pattern
splurge-sql-runner -c "sqlite:///database.db" -p "*.sql"

# With verbose output
splurge-sql-runner -c "sqlite:///database.db" -f "script.sql" -v

# JSON output for scripting
splurge-sql-runner -c "sqlite:///database.db" -f "query.sql" --json

📚 Documentation

📋 Requirements

  • Python: 3.10 or higher
  • sqlparse: SQL parsing and validation
  • SQLAlchemy: Database connectivity
  • tabulate: Pretty table formatting

🤝 Contributing

We welcome contributions! Please see our detailed documentation for development setup and contribution guidelines.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


For the complete documentation, visit docs/README-DETAILS.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splurge_sql_runner-2025.7.0.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splurge_sql_runner-2025.7.0-py3-none-any.whl (82.7 kB view details)

Uploaded Python 3

File details

Details for the file splurge_sql_runner-2025.7.0.tar.gz.

File metadata

  • Download URL: splurge_sql_runner-2025.7.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for splurge_sql_runner-2025.7.0.tar.gz
Algorithm Hash digest
SHA256 0451206b09024c22e6241de0edefc3126c4ce54f0666b4da0b3c8eab3c6b77df
MD5 ec6a4df90aa444b55ef2662b329aadeb
BLAKE2b-256 b0ed76ea8e9ab6446c7273fa6143b8e3c467d712a5499a5efb7666748a9c5b10

See more details on using hashes here.

File details

Details for the file splurge_sql_runner-2025.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for splurge_sql_runner-2025.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce91a980e4a24463b3c56d4efbc4a6c05ef91dced8e35122fdf348296db14514
MD5 796a5b3f486a2409d6a20a8fefd5eb7d
BLAKE2b-256 d9bf09cf5551633759d29cca68eb7855740d2fa77d38ab7be15860b443f892b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page