Description |
Python DB-API and SQLAlchemy dialect for Pinot
This module allows accessing Pinot via its SQL API.
Current supported Pinot version: 1.1.0.
Usage
Using the DB API to query Pinot Broker directly:
from pinotdb import connect
conn = connect(host=localhost , port=8000, path=/query/sql , 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)
For HTTPS:
from pinotdb import connect
conn = connect(host=localhost , port=443, path=/query/sql , scheme=https )
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
""
|