Skip to main content

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


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.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

pinotdb-0.2.2-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pinotdb-0.2.2.tar.gz.

File metadata

  • Download URL: pinotdb-0.2.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pinotdb-0.2.2.tar.gz
Algorithm Hash digest
SHA256 89831a1941f0c7e864668addac519a5c1b0dd6fc7746c8b5ed48c1c637dd7f3f
MD5 1c2f22758e9e366a775a4d5ccacfdf55
BLAKE2b-256 3dbb3f936fb853443ec5377bce2cd36f9e058ffeae0daf94e4d58a49fc0cd65d

See more details on using hashes here.

Provenance

File details

Details for the file pinotdb-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pinotdb-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pinotdb-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b46f8aeaa701bf4f586001d9f1ed55bc5eec70daa4b69417f6184ea5af420b1
MD5 952566fe9d39e5babcfa4ea0006da561
BLAKE2b-256 90bde84d454119116ddd862fb53290ae464235877f5fc0e5a37983c6e60355c7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page