Skip to main content

RedPanda: Pandas & SQLAlchemy

pypi python pytest coverage maintainability

Two great tastes that taste great together.

Use RedPanda to add simple pandas integration into your declarative models.

Installation

pip install redpanda

Basic Use

Create a session from a SQLAlchemy engine:

import redpanda

engine = redpanda.create_engine("sqlite://")
# => Engine(sqlite://)

Session = redpanda.orm.sessionmaker(bind=engine)
session = Session()
# => <sqlalchemy.orm.session.Session>

Querying

Use the frame() method of RedPanda queries to return a DataFrame representation of the results instead of a collection of models.

query = session.query(MyModel)
# => <redpanda.orm.Query>

query.frame()
# => <pandas.DataFrame>

Querying with Filters

The frame() method that wraps the pandas.read_sql() function into a dialect-agnostic class-method for declarative SQLAlchemy models and can accept the same keyword arguments as pandas.read_sql():

query = session.query(MyModel).filter_by(my_attr="my_val")

query.frame(index_col="time")

Additionally, a within() method is added to SQLAlchemy's InstrumentedAttribute class that accepts a pandas Index object:

index = pandas.period_range("2016-11-01", "2016-11-30", freq="W")
query = session.query(MyModel).filter(MyModel.timestamp.within(index))

Metadata

Release files for redpanda 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redpanda 0.6.0
File Size Uploaded Provenance Actions
redpanda-0.6.0.tar.gz 8.6 kB Without provenance Details for redpanda-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redpanda 0.6.0
File Interpreter ABI Platform Actions
redpanda-0.6.0-py3-none-any.whl Python 3 none any Details for redpanda-0.6.0-py3-none-any.whl

Total release size: 14.5 kB

Release files / redpanda-0.6.0.tar.gz

Download URL redpanda-0.6.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a0d4351cebd2213e1907c19abb2dd2b1fafe092920142e9978238040f72c9576
BLAKE2b-256 checksum
How to use checksums
c42d8765b12ce9d3b840b405554ed6fca5253392410d9ae006bbf40f6878bf46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / redpanda-0.6.0-py3-none-any.whl

Download URL redpanda-0.6.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d6fdbe9158b4a4d6b570242d73687b8c889255b18e53e192dfe44189d74d629
BLAKE2b-256 checksum
How to use checksums
125c831245e4d337dc5d10557a6d65fbd69e465dd221d3b4bb5d861e3978af64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Security for redpanda 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page