Python DB-API and SQLAlchemy dialect for Pinot.
Project description
Python DB-API and SQLAlchemy dialect for Pinot
This module allows accessing Pinot via its SQL API.
Usage
Using the DB API:
from pinotdb import connect
conn = connect(host='localhost', port=8099, path='/query', scheme='http')
curs = conn.cursor()
curs.execute("""
SELECT place,
CAST(REGEXP_EXTRACT(place, '(.*),', 1) AS FLOAT) AS lat,
CAST(REGEXP_EXTRACT(place, ',(.*)', 1) AS FLOAT) AS lon
FROM places
LIMIT 10
""")
for row in curs:
print(row)
Using SQLAlchemy:
from sqlalchemy import *
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import *
engine = create_engine('pinot://localhost:8099/query?server=http://localhost:9000/') # uses HTTP by default :(
# engine = create_engine('pinot+http://localhost:8099/query?server=http://localhost:9000/')
# engine = create_engine('pinot+https://localhost:8099/query?server=http://localhost:9000/')
places = Table('places', MetaData(bind=engine), autoload=True)
print(select([func.count('*')], from_obj=places).scalar())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pinotdb-0.2.4.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinotdb-0.2.4.tar.gz.
File metadata
- Download URL: pinotdb-0.2.4.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8753aca2c6b14e6c40b059dbc6f7ea98e6b3c4a16faa0a5fe6369aabbc151b9
|
|
| MD5 |
06afe8c2d774948678bf7472b3caf2f9
|
|
| BLAKE2b-256 |
754d537baefd2d8f748018f1d9df310de12bad27334aa3991c850a532d7d5411
|
File details
Details for the file pinotdb-0.2.4-py2.py3-none-any.whl.
File metadata
- Download URL: pinotdb-0.2.4-py2.py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8b5f04b90a5a5601a45a1371911730e4f5a787b774427070519bdb98656e741
|
|
| MD5 |
9a4b66e0b0fd2963899c4f64c38d81e3
|
|
| BLAKE2b-256 |
e2dd1c4aaf587de378d17791f6dd7e73d96cfcc59147763ed40fbb6f7c69cfd4
|