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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlthunder-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 863111dc7deef66bb99ba1b229723b3e8807eb073ac7f8793d0b606558ea2d61
MD5 4fc13707fee456b3856f4ee7d21ffe93
BLAKE2b-256 9f086adc225028188eab471939e76cd1e2fb548b519af162cca1e18b257c86a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlthunder-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24d916aabdb741350dd6695687b559263c1267f185688667a8b7766fa025c7ac
MD5 0bd14c9dae0043c0e869e7762f7e0ef6
BLAKE2b-256 a5dadd221efbdc4e1a365714534626af6bc8cee5a63bc41c3e983cda3bd55f63

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