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.19.tar.gz
(14.7 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.19-py3-none-any.whl
(13.3 kB
view details)
File details
Details for the file sqlbear-0.1.19.tar.gz.
File metadata
- Download URL: sqlbear-0.1.19.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7c4ae5d19e703a1f08cb364b604889c630ea526a357d0a60fc75ec0674a51a
|
|
| MD5 |
24b2f96c5062d81c8626203e0e24a1e6
|
|
| BLAKE2b-256 |
6b68821b1e948a24415576dc37b217a125aaef57d7e5c6696dec4ab0ff6f37d9
|
File details
Details for the file sqlbear-0.1.19-py3-none-any.whl.
File metadata
- Download URL: sqlbear-0.1.19-py3-none-any.whl
- Upload date:
- Size: 13.3 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 |
c32bf040282f8498c57149385bc3da1f22c96fb810a7edd4a0d300ab7be84d79
|
|
| MD5 |
ce352b611442275414ad9b51a4ea8367
|
|
| BLAKE2b-256 |
9968fc016b9f2c53819cc171c93f8485e94735b1bcba098e02ff4d9da7ea6caf
|