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

Uploaded Source

Built Distribution

pinotdb-0.2.5-py2.py3-none-any.whl (11.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pinotdb-0.2.5.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for pinotdb-0.2.5.tar.gz
Algorithm Hash digest
SHA256 9bbde5d846dc7e29707295f2b354f47b17e6157c906714a5e8519bdb3241f276
MD5 e0b3e858137e50c4b266ec4464512787
BLAKE2b-256 44f71eb26b34818b1e901520e5e76ab8ded59332ff628e8a6789df15ff03fde7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pinotdb-0.2.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for pinotdb-0.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 01b03b0a8d561aca2cf174ad15ed3d2cca453bdc231863c382420ea213c45c09
MD5 2433d48ff148eb7766a07f15b5254faa
BLAKE2b-256 0e554ed03b1adb0fcf4d9ba1d2e87fbeae05eefb655db916e8a6e31df1d6f83c

See more details on using hashes here.

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