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.0.tar.gz (31.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.5.0-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: splurge_sql_runner-2025.5.0.tar.gz
  • Upload date:
  • Size: 31.2 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.0.tar.gz
Algorithm Hash digest
SHA256 bd836e160cee43dc9ff7821ae8d9e70894fd4a879330585cea91df47d5b3e6f7
MD5 6d9f41c07501ad5e703734a0118dd88d
BLAKE2b-256 800bdbbb2eb48ddc4dda4a3da9f0cb244406121d452c335793eaf8c484a196f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for splurge_sql_runner-2025.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 572302c882561f7ddbeba2484bf562a53d8853d7d4ea2c00afbe36ffb128ef02
MD5 2e75303ca4a448a228101ade7acce189
BLAKE2b-256 476450a02ef34b67553b96a6fa8e9a9ff6316ff63fda9cd22e1a7ceeeff061e9

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