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
Release history Release notifications | RSS feed
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.2.tar.gz
(15.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sqlbear-1.0.2-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file sqlbear-1.0.2.tar.gz.
File metadata
- Download URL: sqlbear-1.0.2.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80edca9ad42e4efd315d7af864b30fd9ea74abdc48efb4eabdfe765ae328ae7c
|
|
| MD5 |
bd9acae13b4e1d05db8a9a0441c6243f
|
|
| BLAKE2b-256 |
56cf7057d6cea6e47e5c12e979034bb7b425ed8fdcef658b9855441fb5c03dfa
|
File details
Details for the file sqlbear-1.0.2-py3-none-any.whl.
File metadata
- Download URL: sqlbear-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc0eaffcd812c94b5ea507e79bc09900a4ccbf6f2e14065905f83928196cd0b6
|
|
| MD5 |
d125a502d8b3b49375f4181efefff95e
|
|
| BLAKE2b-256 |
8ea1722eccc4dcb3a66157ccf6879a013cf0de866279de8d24a9cb63a1dea240
|