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.4.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.4-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file sqlbear-1.0.4.tar.gz.
File metadata
- Download URL: sqlbear-1.0.4.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 |
328f3f0016c1bf94dfa78574ea5ded4e6256ddefffb39d95cf3a8b5d6fd3c05a
|
|
| MD5 |
17be3e51e619615cc8bf59c71c700804
|
|
| BLAKE2b-256 |
3f3cb5362d8ae32d9e0df7bb35976ec87516ffd1a6e923868cc8c6258d4a10b6
|
File details
Details for the file sqlbear-1.0.4-py3-none-any.whl.
File metadata
- Download URL: sqlbear-1.0.4-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 |
cd7832d3828a6b58906a531c3e285c5a65033241a52c9a0f57f7f29f6f76feea
|
|
| MD5 |
baba2e8c3fa117e9b10cc9bedb158074
|
|
| BLAKE2b-256 |
1c24d433f6181960fd14124e454933043a7380897be7f2afd3f937670b15c30a
|