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

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()
# Write 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(tablename='SampleTable')
# Drop table from the database
client.drop_dublicates(tablename='SampleTable')
# Write pandas dataframe to the database. If the table exists you will get an Error.
client.write_table(dataframe=df, tablename='SampleTable', folder='Sample')
# Write pandas dataframe to the database. If the table exists it will be replaced.
client.write_replace_table(dataframe=df, tablename='SampleTable', folder='Sample')

If you want to append data to an existing table, we recommend querying the table to a pandas dataframe using .query_to_df(), doing the transformations within pandas and use .write_replace_table() to overwrite the existing table in the database. This gives you full access to the powerful functions of pandas.

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.1.6.tar.gz (4.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.1.6-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kustopy-1.1.6.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

Hashes for kustopy-1.1.6.tar.gz
Algorithm Hash digest
SHA256 af0741df97d8cbca5d33b7174837a151abbf0d0ba2c14456342edb52cc354040
MD5 7cc29cc9fd3d88d48974f3c9e6d0fe68
BLAKE2b-256 f37fbee14adfd7372a08b12f8f6b014cbfc5dc4bbf0de954f8d235e99f3802db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kustopy-1.1.6-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

Hashes for kustopy-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 23acf16c5242d0244af85d4438c1df510d17ec0c95041a4d7ed910821d551228
MD5 97cd7e20431f78a06becb1101d0fba65
BLAKE2b-256 6b3973b094ea94275721dc1fd1f2329e288fa83625545247eb6ded0cd82ffaa3

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