Skip to main content

Apache Kylin Python Client Library

Project description

https://img.shields.io/pypi/v/kylinpy.svg

Apache Kylin Python Client Library

Apache Kylin Python Client Library is a python-based Apache Kylin client.

Any application that uses SQLAlchemy can now query Apache Kylin with this Apache Kylin dialect installed.

Installation

The easiest way to install Apache Kylin Python Client Library is to use pip:

pip install --upgrade kylinpy

Alternatiely, you may install this library from local project path, You are welcomed to also commit to this library:

git clone https://github.com/Kyligence/kylinpy.git
pip install -e kylinpy

Apache Kylin dialect for SQLAlchemy

Any application that uses SQLAlchemy can now query Apache Kylin with this Apache Kylin dialect installed. It is part of the Apache Kylin Python Client Library, so if you already installed this library in the previous step, you are ready to use.

You may use below template to build DSN to connect Apache Kylin:

kylin://<username>:<password>@<hostname>:<port>/<project>

DSN Field

Default Value

username

password

hostname

port

7070

project

SQLAlchemy create_engine takes an argument connect_args which is an additional dictionary that will be passed to connect().

key

Default Value

is_ssl

False

prefix

kylin/api

timeout(unit: seconds)

30

unverified

True

version

v1

is_pushdown

False

From SQLAlchemy access Apache Kylin

$ python
>>> import sqlalchemy as sa
>>> kylin_engine = sa.create_engine('kylin://ADMIN:KYLIN@sandbox/learn_kylin', connect_args={'is_ssl': True, 'timeout': 60})
>>> results = kylin_engine.execute('SELECT count(*) FROM KYLIN_SALES')
>>> [e for e in results]
[(4953,)]
>>> kylin_engine.table_names()
[u'KYLIN_ACCOUNT',
 u'KYLIN_CAL_DT',
 u'KYLIN_CATEGORY_GROUPINGS',
 u'KYLIN_COUNTRY',
 u'KYLIN_SALES',
 u'KYLIN_STREAMING_TABLE']

From Pandas access Apache Kylin

$ python
 >>> import sqlalchemy as sa
 >>> import pandas as pd
 >>> kylin_engine = sa.create_engine('kylin://ADMIN:KYLIN@sandbox/learn_kylin', connect_args={'is_ssl': True, 'timeout': 60})
 >>> sql = 'select * from kylin_sales limit 10'
 >>> pd.read_sql(sql, kylin_engine)

From Superset access Apache Kylin

Now you can configure the DSN in your application to establish the connection with Apache Kylin.

For example, you may install Apache Kylin Python Client Library in your Superset environment and configure connection to Apache Kylin in Superset

https://raw.githubusercontent.com/Kyligence/kylinpy/master/docs/picture/superset1.png

then you may be able to query Apache Kylin one table at a time from Superset

https://raw.githubusercontent.com/Kyligence/kylinpy/master/docs/picture/superset2.png

you may also be able to query detail data

https://raw.githubusercontent.com/Kyligence/kylinpy/master/docs/picture/superset3.png

Alternatively, you may also be able to query multiple tables from Apache Kylin by using SQL Lab in Superset.

https://raw.githubusercontent.com/Kyligence/kylinpy/master/docs/picture/superset4.png

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

kylinpy-2.3.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kylinpy-2.3.0-py3.6.egg (60.1 kB view details)

Uploaded Egg

File details

Details for the file kylinpy-2.3.0.tar.gz.

File metadata

  • Download URL: kylinpy-2.3.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for kylinpy-2.3.0.tar.gz
Algorithm Hash digest
SHA256 6ffd1d4ee9d2be3d531245f4b7c44d879f331d053a360a51361edd3e755f69c3
MD5 f72ec721584b689e74143bc85ce1c9a3
BLAKE2b-256 a309db045c5cc751219784bf1e062e73024007884e2799328f0024feb1ab7c0e

See more details on using hashes here.

File details

Details for the file kylinpy-2.3.0-py3.6.egg.

File metadata

  • Download URL: kylinpy-2.3.0-py3.6.egg
  • Upload date:
  • Size: 60.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for kylinpy-2.3.0-py3.6.egg
Algorithm Hash digest
SHA256 86bb5d6a2b818f76a934b785e2d52ab2444192eb03a553a01b3459f7ba041679
MD5 722f274ac30959f3c60aa0693911abe7
BLAKE2b-256 8ed50bee472325ead77f9fc69f51a1074aea231dc8f2693b67fbe01526c92147

See more details on using hashes here.

Supported by

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