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.3.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.3-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlthunder-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f04708b9c473500dd92ba82434e017da8abd78c78400fd75db9597dbf7d9d2af
MD5 755ff8e435f88e58a86bd62fdf065c38
BLAKE2b-256 f8e8904b2af98bf40005246eb141c9220baa097726b863ed26fe86ba56ad6307

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlthunder-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29449fe833c6f1102814dcfcc9e557bf53a368f6be610ba07231801c6614f232
MD5 f386d6e25a97c89c98b11ca54a1d1ff3
BLAKE2b-256 b91147a5df9531ea5af22a7539d1510b686472430e06019a084e19f688a730e9

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