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.12.tar.gz
(14.0 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.12-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file sqlbear-0.1.12.tar.gz.
File metadata
- Download URL: sqlbear-0.1.12.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8134bf8268dbebcccc0af224d0441ffb2080d88930d7ea0bdadf9200b739c9a
|
|
| MD5 |
8fbaf16a25d15c80eb6e38adb65aa93e
|
|
| BLAKE2b-256 |
c96ebc47b9f01678f2e9482b04b2a8385fe1956c53f6aeb91314a4289230787d
|
File details
Details for the file sqlbear-0.1.12-py3-none-any.whl.
File metadata
- Download URL: sqlbear-0.1.12-py3-none-any.whl
- Upload date:
- Size: 12.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 |
cc964c45c90347bf8426bf8eb947fbae93079900bc8d071881dcd69be823fd8c
|
|
| MD5 |
1e7650baa3cea069370f46f81f65f792
|
|
| BLAKE2b-256 |
58b2fc91027ac6533a3ef7e720d10f667f85d9ee5380ecc31b889730aa10dc3c
|