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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlthunder-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 fe641a0519b8da20f647bd9095eaa50ff63b78a6f27d217ea88eaa6f0a6e4731
MD5 349438971c19f699d28902590fd36b3a
BLAKE2b-256 4974868de1fbb45b4134c57947d4df1b4b2a991eea346cb7fe517270a42be984

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlthunder-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae38fdfd8f6d6da92ba681841703d43c7034d6ec0636794c124e1a0c3954304b
MD5 0939811c9bb657c5853f87a0c7da841d
BLAKE2b-256 62bd234dd2ac2ebbc4179cfb5021cc200b23f47ead718b21568b55690fdf0ae8

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