Skip to main content

Advanced python SDK for Azure Data Explorer

Project description

Introduction

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

Installation

pip install pykusto

Usage

from datetime import timedelta
from pykusto.client import PyKustoClient
from pykusto.query import Query

# Connect to cluster with AAD device authentication
# Databases, tables, and columns are auto-retrieved
client = PyKustoClient('https://help.kusto.windows.net')

# Show databases
print(tuple(client.get_databases_names()))

# Show tables in 'Samples' database
print(tuple(client.Samples.get_table_names()))

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

# Build query
(
    Query(t)        
        # 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))
        .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.

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

Uploaded Source

Built Distribution

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

pykusto-0.0.14-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file pykusto-0.0.14.tar.gz.

File metadata

  • Download URL: pykusto-0.0.14.tar.gz
  • Upload date:
  • Size: 35.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/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pykusto-0.0.14.tar.gz
Algorithm Hash digest
SHA256 85e974637874285c0e522f1eaed04879e6975100261a564233993b494aae467c
MD5 a2d58cd64a4480037977dbb1343aaf32
BLAKE2b-256 a56379b88bd8419032e5149c17401776d9c92458713220f6f8a644076922b5a7

See more details on using hashes here.

File details

Details for the file pykusto-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: pykusto-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pykusto-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f9c597b9751dcdf13d96f8c39a6f857f8e1b10706d88889c439c9ba0348892
MD5 2a3ff8948bdec56e5964a32d3e98fd44
BLAKE2b-256 32bb8d093d7ba21c3bdd5229b6d205bf17e364f053276d35be600d707b3e64db

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