Query and Ingestion Client for Azure using Python
Project description
Getting started
kustopy is a Python SDK for Azure Data Explorer (Kusto).
Installation and Import
pip install kustopy
from kustopy import KustoPyClient as kpc
QueryClient
# Get login credentials from Azure Vault
client_id = dbutils.secrets.get(scope="ce5", key="adxClientId")
client_secret = dbutils.secrets.get(scope="ce5", key="adxClientSecret")
tenant_id = dbutils.secrets.get(scope="ce5", key="adxTenantId")
# Set up the query client
query_client = kpc.QueryClient(cluster='https://sample.kusto.windows.net/',
database='confidential-satanalytics-sample',
client_id=client_id,
client_secret=client_secret,
tenant_id=tenant_id,
truncation=False)
# Get list of all tables available in database
query_client.get_table_names()
# Write kusto queries to get data into pandas dataframe
query_client.query_to_df(user_input='SampleTable | take 100 | where fruit=="apple"')
IngestionClient
# Get login credentials from Azure Vault
client_id = dbutils.secrets.get(scope="ce5", key="adxClientId")
client_secret = dbutils.secrets.get(scope="ce5", key="adxClientSecret")
tenant_id = dbutils.secrets.get(scope="ce5", key="adxTenantId")
# Set up the ingestion client
query_client = kpc.IngestionClient(cluster='https://sample.kusto.windows.net/',
database='confidential-satanalytics-sample',
client_id=client_id,
client_secret=client_secret,
tenant_id=tenant_id,
truncation=False)
# Drop table from the database
ingestion_client.drop_table(tablename='SampleTable')
# Write pandas dataframe to the database. If the table exists you will get an Error.
ingestion_client.write_table(dataframe=df, tablename='SampleTable')
# Write pandas dataframe to the database. If the table exists it will be replaced.
ingestion_client.write_replace_table(dataframe=df, tablename='SampleTable')
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
kustopy-1.0.22.tar.gz
(4.2 kB
view details)
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.0.22.tar.gz.
File metadata
- Download URL: kustopy-1.0.22.tar.gz
- Upload date:
- Size: 4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d55e1ac86de494f3ee4df4c539294597168e23c7b14d62776dff20ea584b69c8
|
|
| MD5 |
eb4cff034ca2647f71bf5935a5f7544c
|
|
| BLAKE2b-256 |
96392737604a8d056db0cc801e1a4a1f9599c209b2787845404dad70343cb38b
|
File details
Details for the file kustopy-1.0.22-py3-none-any.whl.
File metadata
- Download URL: kustopy-1.0.22-py3-none-any.whl
- Upload date:
- Size: 4.4 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 |
aa1fd065932893efb3b0be5deed5df905ae03d53c03f356dd171a704e2753c99
|
|
| MD5 |
4f434f20d7076c5aed46b223dcaa3c5b
|
|
| BLAKE2b-256 |
bdfa562f8e716d107e1e9ff741a4b1e4e7bbaba763110d7d851d11bdd9c61295
|