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.20.tar.gz
(15.2 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.20-py3-none-any.whl
(13.8 kB
view details)
File details
Details for the file sqlbear-0.1.20.tar.gz.
File metadata
- Download URL: sqlbear-0.1.20.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7dfabf71779b08d0efb4bb0bca477d5613dcc562ffb9ad7f387145967ad3e3d
|
|
| MD5 |
61caf196a3e79f3a5c9ee0a4ae54663c
|
|
| BLAKE2b-256 |
5ebb13fee2a108dfdac2e41345e6c13d565c2742386523b71a3dde6994a3434c
|
File details
Details for the file sqlbear-0.1.20-py3-none-any.whl.
File metadata
- Download URL: sqlbear-0.1.20-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.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
178432f188a36967a75995fc1877f087c8243a5fdac7bd0cedf8c8835af60582
|
|
| MD5 |
69509e818b0e5a61948edcbab977b030
|
|
| BLAKE2b-256 |
f6354e2b953a297d24b424dc55a3695d5d017837bf85329e90ab9f5a5f51c279
|