Skip to main content

Wrapper for sqlalchemy engine that provides functions for handoff with pandas

Project description

SQLBear is a lightweight wrapper around SQLAlchemy and Pandas to simplify SQL interactions.

Installation

pip install sqlbear

Usage

from sqlbear import SQLBear
from datetime import datetime
# Connects to sqlite database
connection_str = "sqlite:///example.db"
sqlbear = SQLBear(connection_str)
# Query account and user tables
df = sqlbear.read_sql_query("SELECT * FROM users JOIN account ON users.account = account.id WHERE lastUpdated > DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)")
# Perform some transformation
df['added_to_report'] = datetime.now()
# Write to new or existing sql table, handling new columns, mismatched sql types, timezone issues if present, and duplicates across the user_id column
nob_bear.put_table(
    'account_users',
    'user_id',
    df,
    ['id','user_id']
)

Features

  • Efficient SQL querying with progress bars

  • Automatic handling of time zones and schema updates

  • Simple table insertion and schema validation

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

sqlbear-1.0.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

sqlbear-1.0.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlbear-1.0.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for sqlbear-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b89868c2e0464a927ee469647a838717b52b6764f9735abf1c22a74f7383c586
MD5 240ac89f8bc7998fc8b1ea77da41d3c3
BLAKE2b-256 c0f960ae6d7b4c51f8f1fb17f09fb5c9a4969a6896b6e21c8d58e563a791c577

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlbear-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for sqlbear-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82ec8cba05d68591dc930d140c8cd2ac0f6d5ea2277768ff79a5f2b13dc299b0
MD5 58eaff48560d430dda794267abafc7a9
BLAKE2b-256 0be4cc5897c3743ac51174c954dd1c47340b8b77fbdc669618ca7c3476666e45

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