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.8.0.tar.gz (90.2 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.8.0-py3-none-any.whl (118.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: splurge_sql_runner-2025.8.0.tar.gz
  • Upload date:
  • Size: 90.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for splurge_sql_runner-2025.8.0.tar.gz
Algorithm Hash digest
SHA256 422dca813b9c819ff14940c5015f7c71eb8302b9798ecabde398564572ed3ca0
MD5 b775ef001d2291c689ff9c86f3a1b43b
BLAKE2b-256 8a7128720779748a392de3178f3aeb408faba1c681490590d311d2b965ab0cb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for splurge_sql_runner-2025.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f41d0011175d89c034f146f5461d30595f2b4be2f47a6236290e83686b89308
MD5 54075be1e40e1794e7039681d20a6535
BLAKE2b-256 4d82d553796972d373b612b1640076a82c1463ca1f2ae1fd5381179993d02829

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