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.3.tar.gz
(11.3 kB
view details)
Built Distribution
File details
Details for the file pinotdb-0.2.3.tar.gz
.
File metadata
- Download URL: pinotdb-0.2.3.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 | ffef998c4d774fc1720fb6e28b389a5c6fec8b39c2c621dea87d3b9e8b6f3153 |
|
MD5 | 937caf58c2cbdbf543ef764996c8b276 |
|
BLAKE2b-256 | 06c43291c0ecf0bf0b932d4a1e73f15bd2f5a5cab188e09143eba5722cad4cde |
Provenance
File details
Details for the file pinotdb-0.2.3-py2.py3-none-any.whl
.
File metadata
- Download URL: pinotdb-0.2.3-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 | 711ea50ad1bc70c3bbe31d338232b9fc198876d96fb9273b86b8b03f326663b4 |
|
MD5 | 5f318fe27b8adc185d01e892282c5952 |
|
BLAKE2b-256 | 438e29578a22851ac365d77470fcb59f39498647d0183f76d909979683c842ba |