Skip to main content

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


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.3.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlbear-1.0.3-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlbear-1.0.3.tar.gz.

File metadata

  • Download URL: sqlbear-1.0.3.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

Hashes for sqlbear-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f967d942af1cdbd5eb30cebb2abe271299f8ffcf10193945e2aaee950f6fa23e
MD5 3b6f6d7d7e059f9e0fcd556a5d8e8bcd
BLAKE2b-256 a2f841b1eaa4713cbde8e6589d71e8ff0ed32e609d7319ec9e533b791a5e2991

See more details on using hashes here.

File details

Details for the file sqlbear-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: sqlbear-1.0.3-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

Hashes for sqlbear-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6caff3a94491ae9d198a2c967d8bc84c6e089c792c4131078b94b2d3af17a190
MD5 4c23fb401c9ad7a7cc4ba3c2436404ed
BLAKE2b-256 7d78b9125371de1dac7ca172690dcc67d79ac03c07c1817f23963fe8405399d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page