Skip to main content

A flexible, high-level SQL client for Python that simplifies database interactions across SQLite, MySQL, and PostgreSQL

Project description

SQLThunder

PyPI Version Python Versions License Docs codecov Integration and Unit Tests Pre-Commit Checks


What is it ?

SQLThunder is a fast, flexible SQL client for Python designed for real-world workloads across PostgreSQL, MySQL, and SQLite. It offers a cleaner, high-level API over SQLAlchemy, with support for multi-threaded operations, flexible result formats, YAML-based configuration, and a built-in CLI.

The best thing about SQLThunder: no boilerplate code !


Table of Contents


Features

  • Threaded execution for fast inserts, updates, and deletes — designed for large-scale data workflows
  • Declarative inserts with automatic SQL generation from dictionaries or DataFrames
  • Key-based pagination and chunked queries for scalable data extraction
  • Flexible result formats: return data as pandas.DataFrame, list of rows, or raw SQLAlchemy objects
  • Graceful error handling with optional success flags and failure DataFrames
  • YAML-based configuration for clean, environment-agnostic connection setup
  • Built-in CLI for quick querying, inserting, and executing SQL without writing code
  • Full test coverage including unit tests, integration tests, and Dockerized database backends
  • Minimal boilerplate — write less code and get more done

Installation

pip install sqlthunder

Example Usage

from SQLThunder import DBClient

client = DBClient("config.yaml")
df = client.query("SELECT * FROM trades WHERE symbol = 'AAPL')
import pandas as pd
from SQLThunder import DBClient

df = pd.read_excel("data.xlsx")
client = DBClient("config.yaml")
failed_rows, success_flag = client.insert_batch(df, "my_schema.my_table", on_duplicate="ignore", return_status=True)
from SQLThunder import DBClient

client = DBClient("config.yaml")
client.execute(
    """
    CREATE TABLE IF NOT EXISTS trades (
        id INT PRIMARY KEY,
        symbol VARCHAR(10) NOT NULL,
        price DECIMAL(10, 2) NOT NULL,
        trade_time DATETIME DEFAULT CURRENT_TIMESTAMP
    )
    """
)

CLI Usage

# Run a query
sqlthunder query "SELECT * FROM trades" -c config.yaml --print

# Insert from file
sqlthunder insert data.xlsx schema.table -c config.yaml

# Run DDL or DML
sqlthunder execute "DELETE FROM logs" -c config.yaml

Documentation

https://sqlthunder.readthedocs.io


Contributing

See CONTRIBUTE.txt to get started. PRs and feedback are welcome!


License

MIT — see LICENSE for details.

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

sqlthunder-1.0.1.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

sqlthunder-1.0.1-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file sqlthunder-1.0.1.tar.gz.

File metadata

  • Download URL: sqlthunder-1.0.1.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for sqlthunder-1.0.1.tar.gz
Algorithm Hash digest
SHA256 778f9afddccd324c03aa36a8af6dc97793033fea6f2ef56b6974971b89ec8639
MD5 a34a571878ebb9621c8854d827496b4b
BLAKE2b-256 cb8929cb97027aa0d7e6bea8eb5f49035648f4e4e68e9b903983a24ba8017753

See more details on using hashes here.

File details

Details for the file sqlthunder-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sqlthunder-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for sqlthunder-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b01f90c65a21f9058feec6f618109f915b6b9886747f6552238fd261168851bc
MD5 e3cd694b27d5a0e6f6dc9b99bd9a16c4
BLAKE2b-256 a8fde8015f54389af0890d7a236c80ff34d9be51ecd983628aa4511d27ca1518

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