Skip to main content

Sqlachemy Query WRapper Library - pandas-like SQL

Project description

sqwrl

Sqlachemy Query WRapper Library

Quickstart

Install is easy via pip install sqwrl.

import pandas as pd
from sqwrl import DB
db = DB('sqlite:///:memory:')
df = pd.DataFrame({"x": [1,2,3,4,5], "y": list("abcdf"), "z": [1.0, 1.5, 1.5, 1.2, 1.3]}).set_index("y")
ans_df = pd.read_csv("tests/anscombe.csv")
db["anscombe"] = ans_df
ans_tbl = db["anscombe"]
ans_tbl

Now you can (mostly) use the sqwrl table object as if it were a pandas dataframe!

ans_tbl[ans_tbl["dataset"].isin(["I", "II"])][["x", "y"]]

Use the .df attribute on sqwrl table objects to read their output into pandas DataFrames for any unsupported features.

>>> (ans_tbl.df == ans_df).all().all()
True

See usage for more usage examples.


Basic Features:

  • Smart Pandas like wheres using getitem
  • .loc operations
  • Indexing (including reset_index, drops, and appending)
  • Sorting
  • Most arithmetic operations lazily pushed
  • Metadata like length and dtypes

Advanced Features:

  • Groupby
    • Groupby group iteration
    • Groupby aggregation
    • Groupby aggregation over multiple columns
    • Groupby group sizes
    • Groupby transform and apply
  • Joins
    • Pandas-style joins (have the basic framework in place for this)
  • Mutation
    • Adding, deleting, and editing columns
    • Appending existing tables
    • Deleting or editing based on conditions

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

sqwrl-0.1.0.tar.gz (13.5 kB view hashes)

Uploaded Source

Built Distributions

sqwrl-0.1.0-py3.8.egg (29.1 kB view hashes)

Uploaded Source

sqwrl-0.1.0-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

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