pinot-connect
Installation
pip install pinot-connect
# or
poetry add pinot-connect
# or
uv add pinot-connect
Overview
pinot_connect is a DB-API 2.0 compliant and statically typed driver for querying Apache Pinot with Python. It supports both synchronous and asynchronous execution, making it flexible for a variety of applications.
Powered by:
pinot_connect outperforms pinotdb in benchmarks. On average for queries that return 100 or more rows, you can
expect to see ~15-30% faster execution.
Documentation
The full documentation can be found here.
Quickstart
Running a quick start Pinot cluster
To start an Apache Pinot cluster with example data, run:
docker run -d --name pinot-quickstart -p 9000:9000 \
-p 8099:8000 \
--health-cmd="curl -f http://localhost:9000/health || exit 1" \
--health-interval=10s \
--health-timeout=5s \
--health-retries=5 \
--health-start-period=10s \
apachepinot/pinot:latest QuickStart -type batch
This command launches a Pinot instance with preloaded batch data, making it easy to start querying right away.
Querying with pinot_connect
Once your cluster is up and running, you can query it using pinot_connect. Below are examples for both synchronous and asynchronous usage.
import pinot_connect
from pinot_connect.rows import dict_row
with pinot_connect.connect(host="localhost") as conn:
with conn.cursor(row_factory=dict_row) as cursor:
cursor.execute("select * from airlineStats limit 100")
for row in cursor:
print(row)
import pinot_connect
from pinot_connect.rows import dict_row
import asyncio
async def main():
async with pinot_connect.AsyncConnection.connect(hose="localhost") as conn:
async with conn.cursor(row_factory=dict_row) as cursor:
await cursor.execute("select * from airlineStats limit 100")
async for row in cursor:
print(row)
asyncio.run(main())
What's Happening Here?
-
Standard DB-API 2.0 Interface
pinot_connectprovides a familiar connection and cursor interface, similar to popular Python database clients such assqlite3orpsycopg -
Row Factories
Therow_factoryparameter lets you customize how rows are returned. In this example,dict_rowreturns results as dictionaries. You can choose from built-in factories or define your own. See the row factories documentation for details. -
Type Mapping
pinot_connectautomatically converts Pinot data types to their Python equivalents. More details are available in the type conversion documentation. -
Cursor Iteration & Fetch Methods
You can iterate over results directly or usefetchone(),fetchmany(),fetchall(), andscroll(), following the DB-API spec. See the usage docs or reference docs for more details.
Metadata
Release files for pinot-connect 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pinot_connect-0.1.1.tar.gz | 19.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pinot_connect-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.9 kB
Release files / pinot_connect-0.1.1.tar.gz
| Download URL | pinot_connect-0.1.1.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db145b4512ad4715979fd48f4eac44e422f2d9effe22b30b8fb631f44ef9a548
|
|
BLAKE2b-256 checksum How to use checksums |
169fc5338b087287c9a3bab63fa744aeaa43508a54a4132cfcbf51559fa4ed1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.9.21 Linux/6.8.0-1021-azure
|
Release files / pinot_connect-0.1.1-py3-none-any.whl
| Download URL | pinot_connect-0.1.1-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb0b2ea8ccb394617a79e490d1f0e2f1603a55f4e06cd1ed0830b91ca2de1080
|
|
BLAKE2b-256 checksum How to use checksums |
1f0e934c695c89cff858b8732e5f25c9494b89b8dcd5b3e7297d6eaaf0abf993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.9.21 Linux/6.8.0-1021-azure
|