Skip to main content

Advanced python SDK for Azure Data Explorer

Project description


pykusto is an advanced Python SDK for Azure Data Explorer (a.k.a. Kusto).
Started as a project in the 2019 Microsoft Hackathon.

PyPI version Downloads

Getting Started


Default installation:

pip install pykusto

With dependencies required for running the tests:

pip install pykusto[test]

Without dependencies which are not needed in PySpark:

pip install pykusto --global-option pyspark

Basic usage

from datetime import timedelta
from pykusto import PyKustoClient, Query

# Connect to cluster with AAD device authentication
# Databases, tables, and columns are auto-retrieved
client = PyKustoClient('')

# Show databases

# Show tables in 'Samples' database

# Connect to 'StormEvents' table
t = client.Samples.StormEvents

# Build query
        # Access columns using table variable 
        .project(t.StartTime, t.EndTime, t.EventType, t.Source)
        # Specify new column name using Python keyword argument   
        .extend(Duration=t.EndTime - t.StartTime)
        # Python types are implicitly converted to Kusto types
        .where(t.Duration > timedelta(hours=1))
        # Output to pandas dataframe

Retrying failed queries

# Turn on retrying for all queries
from pykusto import PyKustoClient, RetryConfig, Query

client = PyKustoClient(
    retry_config=RetryConfig()  # Use default retry config 

# Override retry config for specific query 
    retry_config=RetryConfig(attempts=3, sleep_time=1, max_sleep_time=600, sleep_scale=2, jitter=1)


This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

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

pykusto-0.2.0.tar.gz (56.7 kB view hashes)

Uploaded source

Built Distribution

pykusto-0.2.0-py3-none-any.whl (40.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page