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
  • SQLAlchemy: Database connectivity
  • splurge-safe-io: Secure file I/O operations

🤝 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.5.2.tar.gz (34.0 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.5.2-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: splurge_sql_runner-2025.5.2.tar.gz
  • Upload date:
  • Size: 34.0 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.5.2.tar.gz
Algorithm Hash digest
SHA256 e24305284ef0b1fb63186a6a4fa13493c0983656b4d5c42b0e8f17a65d1bf029
MD5 930123b7feab215ceb3300e33247915b
BLAKE2b-256 1c9277742b0a53923c95c421a26226deb76aad3776ddf71345818a16ed033e44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for splurge_sql_runner-2025.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de8c76c2cfc8f2a1a1d7e4312bc4a4014f594500d6b14a4197b5564cbc683779
MD5 f8a5e43fb3f2d5c19900a0674f4a219a
BLAKE2b-256 a8f22d5ed9f701f471a00f4a7efba89201443f6768a0d22c82935afd3d8fdd44

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