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-0.1.13.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

sqlbear-0.1.13-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sqlbear-0.1.13.tar.gz
Algorithm Hash digest
SHA256 af6827ae60100b2f80791e01ac40dcb284907d97267f35f835d3200e9af3249f
MD5 fcfeb805bc0be4fb9e44a3a4a1ccf1b0
BLAKE2b-256 77f24696420ca53d0547939a7dba823661c28f91dfa5f379e5a63194fb5701e4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sqlbear-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d6581bd763a5f5d15cd4a67015317266350803ab939d9e0f86b4126e3b59f636
MD5 ee9744122eacc0fc2d14fbe62d495265
BLAKE2b-256 10632a29dbe98ec10a3ba4fced24160c34b3b2b084a3cd3d324cb60218b6815b

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