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.1.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.1-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file sqlbear-1.0.1.tar.gz.
File metadata
- Download URL: sqlbear-1.0.1.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 |
f6db1bc9851570953df4b77030529ad4e75262f40a83c5d090cbbb51b5957921
|
|
| MD5 |
1bdd04d8cf43f6ba05f0baed1c54f88a
|
|
| BLAKE2b-256 |
21861e68518c9d190ac8e0b1c5715efbb6555fb20e6daceb8c968dedd64a323e
|
File details
Details for the file sqlbear-1.0.1-py3-none-any.whl.
File metadata
- Download URL: sqlbear-1.0.1-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 |
9ceaad3382851e83117364032cf7f824bc9046c2433bae243bc10e1df0b8fadb
|
|
| MD5 |
cc7881a1c07f887b1f86676ec39f09ad
|
|
| BLAKE2b-256 |
2efe054ec7cb527925971d2b349486ba4a3c4fb5cd61474c490adb266809377c
|