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-0.1.11.tar.gz
(13.1 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-0.1.11-py3-none-any.whl
(11.7 kB
view details)
File details
Details for the file sqlbear-0.1.11.tar.gz.
File metadata
- Download URL: sqlbear-0.1.11.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d07796da1fb57b8abc99be1ad13152a967a2d843d4455b9c044949c97edad2b
|
|
| MD5 |
b1d290826f4f4ab82ab091d9d7c75ea5
|
|
| BLAKE2b-256 |
061c469c900dc1c223c67671d170183cc965b6ee2c07f3b233e88f02b4da8a55
|
File details
Details for the file sqlbear-0.1.11-py3-none-any.whl.
File metadata
- Download URL: sqlbear-0.1.11-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e6d0f4903fab3c5fdcd334f98ae59cec6c8f20b5bbcb2bc9aaa8182aa1c964
|
|
| MD5 |
dfc88d88f628fef41490418ab2a496a6
|
|
| BLAKE2b-256 |
83523fe1d76b7b3790efc91814cfe55060e8c4adc4adb716f8322d710ab46e44
|