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.6.0.tar.gz (65.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.6.0-py3-none-any.whl (81.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: splurge_sql_runner-2025.6.0.tar.gz
  • Upload date:
  • Size: 65.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.6.0.tar.gz
Algorithm Hash digest
SHA256 b22b74ec3ddb023cc3226d827d906c22515f0290cf56697799df439c5af394be
MD5 08ea10ed3d7aecf2ac32ba52bca70f33
BLAKE2b-256 9e9a1910a25cea0512766f987cd16a8bcda6819828f7bd8450cbe6f89faa769a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for splurge_sql_runner-2025.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 921bde36b12b28783134829fa8473f216f1bd83085c4ccadf455c197aa478d75
MD5 0a4047fa2fef3f5c40119906da78d8f6
BLAKE2b-256 741ccc8217a9da84b8831dd8d2189cdd097e015364fb68b3cec2c5fd7880ac42

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