Skip to main content

Query and Ingestion Client for Azure using Python

Project description

Getting started

kustopy is a Python SDK for Azure Data Explorer (Kusto).

PyPI version Downloads

Ingestion using pyspark dataframes, is quite slow (compared to ingestion using pandas dataframes). But data is immediately in database after the command is run, while for pandas dataframes it can take while for data to appear.

Installation and Import

pip install kustopy
from kustopy import KustoPyClient as kpc

Client setup

# Set up the query client
client = kpc.Client(cluster='https://sample.kusto.windows.net/',
                    database='sample',
                    client_id=client_id,
                    client_secret=client_secret,
                    tenant_id=tenant_id,
                    truncation=False)

Queries

# Get list of all tables available in database
client.get_table_names()
# Get list of all tables available in database
client.get_schema(table_name='SampleTable')
# Write standard kusto queries. To get the response as pandas dataframe set dataframe to True.
client.query(user_input='SampleTable | take 100 | where fruit=="apple"', data_frame=True)

Ingestions

# Drop table from the database
client.drop_table(table_name='SampleTable')
# Drop table from the database
client.drop_dublicates(table_name='SampleTable')
# Write pandas or pyspark dataframe to the database. If the table exists you will get an Error.
client.write_table(data_frame=df, table_name='SampleTable', folder='Sample')
# Write pandas or pyspark dataframe to the database. If the table exists it will be replaced, otherwise created.
client.write_replace_table(data_frame=df, table_name='SampleTable', folder='Sample')
# Write pandas or pyspark dataframe to the database. If the table exists it will be expanded, otherwise created.
client.write_append_table(data_frame=df, table_name='SampleTable', folder='Sample')

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

kustopy-1.2.7.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

kustopy-1.2.7-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file kustopy-1.2.7.tar.gz.

File metadata

  • Download URL: kustopy-1.2.7.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11

File hashes

Hashes for kustopy-1.2.7.tar.gz
Algorithm Hash digest
SHA256 827d137d8179595844b0be6240c2e73ea6467d57d3979033e6b7fab67a73b30d
MD5 add0945a66faeb68ccf54041c2437cb1
BLAKE2b-256 c026ed99f0dbb253bccb599042f7e8d8412715b00cf69dbdad04a7df9d9f6ea4

See more details on using hashes here.

File details

Details for the file kustopy-1.2.7-py3-none-any.whl.

File metadata

  • Download URL: kustopy-1.2.7-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11

File hashes

Hashes for kustopy-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fee18b06dc46026162a75a13369fe4850b221d2f50e84de4d02c4c217a688865
MD5 9e3404e6e6a21f99970a25cb47e213aa
BLAKE2b-256 d4054693e4945e2f0855a2d01e56598b09a203a3252f2e6c2b39f4e8ca1400c1

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