Query and Ingestion Client for Azure using Python
Project description
Getting started
kustopy is a Python SDK for Azure Data Explorer (Kusto).
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='confidential-satanalytics-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(tablename='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"', dataframe=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(dataframe=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(dataframe=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(dataframe=df, table_name='SampleTable', folder='Sample')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kustopy-1.2.0.tar.gz.
File metadata
- Download URL: kustopy-1.2.0.tar.gz
- Upload date:
- Size: 4.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92ef8c255bd74c089101b74cea95dc5bb2cc4f38d80217be1f27213b240ce309
|
|
| MD5 |
802ece888aae99867af00c142e8300bf
|
|
| BLAKE2b-256 |
99f699b03354cc30317818902485a953fbeb682f0edbf3812d6d717e0774b8cc
|
File details
Details for the file kustopy-1.2.0-py3-none-any.whl.
File metadata
- Download URL: kustopy-1.2.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04be5e2584df33559d27e84e9e865fea5118e8c39caca189012bf78f6430a73a
|
|
| MD5 |
4c7fa48a0a0d4a8893f7d6ae2592d026
|
|
| BLAKE2b-256 |
55ad8ff8ef19f049f9edcba5917e64b37088957728163b85f0c531e810e8840a
|