Query Kusto like a pro from the comfort of your Jupyter notebook
Перейти к файлу
Amos Rimon a41e3f3436 Issue #11 - fix dynamic rendering 2019-08-11 16:12:22 +03:00
.idea xml party 2019-07-25 08:27:29 +03:00
pykusto Issue #11 - fix dynamic rendering 2019-08-11 16:12:22 +03:00
test Issue #11 - fix dynamic rendering 2019-08-11 16:12:22 +03:00
.gitignore move to github 2019-07-30 14:32:19 +03:00
CODE_OF_CONDUCT.md move to github 2019-07-30 14:32:19 +03:00
LICENSE Add license 2019-07-23 08:46:28 +03:00
README.md Fix README: install pykusto fro PyPi 2019-08-06 09:37:45 +03:00
setup.py fix #14: install from pypi in readme, upgrade version 2019-08-07 12:01:06 +03:00

README.md

Introduction

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

Getting Started

Installation

pip install pykusto

Usage

from datetime import timedelta
from pykusto.client import PyKustoClient
from pykusto.query import Query
from pykusto.expressions import column_generator as col

# Connect to cluster with AAD device authentication
client = PyKustoClient('https://help.kusto.windows.net')

# Show databases
print(client.show_databases())

# Show tables in 'Samples' database
print(client['Samples'].show_tables())

# Connect to 'StormEvents' table
table = client['Samples']['StormEvents']

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

Contributing

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 https://cla.opensource.microsoft.com.

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 opencode@microsoft.com with any additional questions or comments.