Tailslide
Median and percentile for Django and MongoEngine
Supports:
- PostgreSQL
- SQLite
- MariaDB
- MySQL (with an extension)
- SQL Server
- MongoDB
🔥 Uses native functions when possible for blazing performance
Installation
Run:
pip install tailslide
For MySQL, also follow these instructions.
Getting Started
Django
Median
from tailslide import Median
Item.objects.aggregate(Median('price'))
Percentile
from tailslide import Percentile
Request.objects.aggregate(Percentile('response_time', .95))
Works with grouping, too, with PostgreSQL, MySQL, and SQLite
Order.objects.values('store').annotate(total=Median('total')).order_by('store')
MongoEngine
Add a custom QuerySet to the models where you want to use it.
from tailslide.mongoengine import TailslideQuerySet
class Item(Document):
meta = {'queryset_class': TailslideQuerySet}
Median
Item.objects.median('price')
Percentile
Item.objects.percentile('price', .95)
Additional Instructions
MySQL
MySQL requires the PERCENTILE_CONT function from udf_infusion. To install it, do:
git clone https://github.com/infusion/udf_infusion.git
cd udf_infusion
./configure --enable-functions="percentile_cont"
make
sudo make install
mysql <options> < load.sql
History
View the changelog
Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/tailslide.git
cd tailslide
pip install --group dev
To run the tests:
# Postgres
createdb tailslide_test
ADAPTER=postgresql pytest tests/django
# SQLite
ADAPTER=sqlite pytest tests/django
# MariaDB
mysqladmin create tailslide_test
ADAPTER=mariadb pytest tests/django
# MySQL (install the extension first)
mysqladmin create tailslide_test
ADAPTER=mysql pytest tests/django
# SQL Server
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
docker exec -it <container-id> /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P YourStrong\!Passw0rd -Q "CREATE DATABASE tailslide_test"
ADAPTER=sqlserver pytest tests/django
# MongoDB
pytest tests/mongoengine
Metadata
Release files for tailslide 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tailslide-0.3.0.tar.gz | 4.9 kB | Without provenance | Details for tailslide-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tailslide-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for tailslide-0.3.0-py3-none-any.whl |
Total release size: 10.1 kB
Release files / tailslide-0.3.0.tar.gz
| Download URL | tailslide-0.3.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5381b0a215c90ab0b016218d5a1fab31514f4914d162c2d60e48fd700f94b287
|
|
BLAKE2b-256 checksum How to use checksums |
7948c473752c252d7771df3b8eb47f3e4c9510d0ef49b495963c7cc5b69e8dc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tailslide-0.3.0-py3-none-any.whl
| Download URL | tailslide-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d02ddbdc3547f13af4753dce4fec699b47264842d3157274f79b0e596843408
|
|
BLAKE2b-256 checksum How to use checksums |
87d92ac26cb24079889d7c6b2a3c73f74cb9e6da3a07fb3fddcf415be410b351
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tailslide 0.3.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.