Microsoft Azure Kusto Library for Python
========================================
Overview
--------
.. code-block:: python
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder
cluster = "<insert here your cluster name>"
client_id = "<insert here your AAD application id>"
client_secret = "<insert here your AAD application key>"
authority_id = "<insert here your AAD tenant id>"
kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(cluster, client_id, client_secret, authority_id)
# It is a good practice to re-use the KustoClient instance, as it maintains a pool of connections to the Kusto service.
# This sample shows how to create a client and close it in the same scope, for demonstration purposes.
with KustoClient(kcsb) as client:
db = "Samples"
query = "StormEvents | take 10"
response = client.execute(db, query)
for row in response.primary_results[0]:
print(row[0], " ", row["EventType"])
*Kusto Python Client* Library provides the capability to query Kusto clusters using Python.
It is Python 3.x compatible and supports
all data types through familiar Python DB API interface.
It's possible to use the library, for instance, from `Jupyter Notebooks
<http://jupyter.org/>`_.
which are attached to Spark clusters,
including, but not exclusively, `Azure Databricks
<https://azure.microsoft.com/en-us/services/databricks/>`_. instances.
Async Client
~~~~~~~~~~~~
Kusto now provides an asynchronous client for queries.
To use the client, first install the package with the "aio" extra:
.. code:: bash
pip install azure-kusto-data[aio]
The async client uses exact same interface as the regular client, except
that it lives in the ``azure.kusto.data.aio`` namespace, and it returns
``Futures`` you will need to ``await`` its
.. code:: python
from azure.kusto.data import KustoConnectionStringBuilder
from azure.kusto.data.aio import KustoClient
cluster = "<insert here your cluster name>"
client_id = "<insert here your AAD application id>"
client_secret = "<insert here your AAD application key>"
authority_id = "<insert here your AAD tenant id>"
async def sample():
kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(cluster, client_id, client_secret, authority_id)
async with KustoClient(kcsb) as client:
db = "Samples"
query = "StormEvents | take 10"
response = await client.execute(db, query)
for row in response.primary_results[0]:
print(row[0], " ", row["EventType"])
Links
~~~~~
* `How to install the package <https://github.com/Azure/azure-kusto-python#install>`_.
* `Kusto query sample <https://github.com/Azure/azure-kusto-python/blob/master/azure-kusto-data/tests/sample.py>`_.
* `GitHub Repository <https://github.com/Azure/azure-kusto-python/tree/master/azure-kusto-data>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/Azure/azure-kusto-python",
"name": "azure-kusto-data",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "kusto wrapper client library",
"author": "Microsoft Corporation",
"author_email": "kustalk@microsoft.com",
"download_url": "https://files.pythonhosted.org/packages/cd/7c/1757a26bb8f86a432d9a27cf0de076062d9754d5fbf36b4d51f94437209d/azure-kusto-data-4.6.1.tar.gz",
"platform": null,
"description": "Microsoft Azure Kusto Library for Python\n========================================\n\nOverview\n--------\n\n.. code-block:: python\n\n from azure.kusto.data import KustoClient, KustoConnectionStringBuilder\n\n cluster = \"<insert here your cluster name>\"\n client_id = \"<insert here your AAD application id>\"\n client_secret = \"<insert here your AAD application key>\"\n authority_id = \"<insert here your AAD tenant id>\"\n\n kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(cluster, client_id, client_secret, authority_id)\n # It is a good practice to re-use the KustoClient instance, as it maintains a pool of connections to the Kusto service.\n # This sample shows how to create a client and close it in the same scope, for demonstration purposes.\n with KustoClient(kcsb) as client:\n db = \"Samples\"\n query = \"StormEvents | take 10\"\n\n response = client.execute(db, query)\n for row in response.primary_results[0]:\n print(row[0], \" \", row[\"EventType\"])\n\n\n\n*Kusto Python Client* Library provides the capability to query Kusto clusters using Python.\nIt is Python 3.x compatible and supports\nall data types through familiar Python DB API interface.\n\nIt's possible to use the library, for instance, from `Jupyter Notebooks\n<http://jupyter.org/>`_.\nwhich are attached to Spark clusters,\nincluding, but not exclusively, `Azure Databricks\n<https://azure.microsoft.com/en-us/services/databricks/>`_. instances.\n\nAsync Client\n~~~~~~~~~~~~\nKusto now provides an asynchronous client for queries.\n\nTo use the client, first install the package with the \"aio\" extra:\n\n.. code:: bash\n\n pip install azure-kusto-data[aio]\n\nThe async client uses exact same interface as the regular client, except\nthat it lives in the ``azure.kusto.data.aio`` namespace, and it returns\n``Futures`` you will need to ``await`` its\n\n.. code:: python\n\n from azure.kusto.data import KustoConnectionStringBuilder\n from azure.kusto.data.aio import KustoClient\n\n cluster = \"<insert here your cluster name>\"\n client_id = \"<insert here your AAD application id>\"\n client_secret = \"<insert here your AAD application key>\"\n authority_id = \"<insert here your AAD tenant id>\"\n\n\n async def sample():\n kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(cluster, client_id, client_secret, authority_id)\n async with KustoClient(kcsb) as client:\n db = \"Samples\"\n query = \"StormEvents | take 10\"\n\n response = await client.execute(db, query)\n for row in response.primary_results[0]:\n print(row[0], \" \", row[\"EventType\"])\n\nLinks\n~~~~~\n\n* `How to install the package <https://github.com/Azure/azure-kusto-python#install>`_.\n\n* `Kusto query sample <https://github.com/Azure/azure-kusto-python/blob/master/azure-kusto-data/tests/sample.py>`_.\n\n* `GitHub Repository <https://github.com/Azure/azure-kusto-python/tree/master/azure-kusto-data>`_.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Kusto Data Client",
"version": "4.6.1",
"project_urls": {
"Homepage": "https://github.com/Azure/azure-kusto-python"
},
"split_keywords": [
"kusto",
"wrapper",
"client",
"library"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "633f81fe148345a17d2b9d8cfe89d5ef4ede49b02e93296550965835ae5eb393",
"md5": "345670d582e7d0fdcfeba3f3a9e947ed",
"sha256": "4531d45cf8045870dac393cb97d82250efb72f2e54e590b966970184946418ce"
},
"downloads": -1,
"filename": "azure_kusto_data-4.6.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "345670d582e7d0fdcfeba3f3a9e947ed",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 51111,
"upload_time": "2024-09-30T06:19:24",
"upload_time_iso_8601": "2024-09-30T06:19:24.027435Z",
"url": "https://files.pythonhosted.org/packages/63/3f/81fe148345a17d2b9d8cfe89d5ef4ede49b02e93296550965835ae5eb393/azure_kusto_data-4.6.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cd7c1757a26bb8f86a432d9a27cf0de076062d9754d5fbf36b4d51f94437209d",
"md5": "a15c08dea3a1ee6c96809cbd16ebe770",
"sha256": "b5f3a76faac58d3ce0e1a7f6ea02b9824d75f3999e8c089a0ef7ad13faf82f44"
},
"downloads": -1,
"filename": "azure-kusto-data-4.6.1.tar.gz",
"has_sig": false,
"md5_digest": "a15c08dea3a1ee6c96809cbd16ebe770",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 41063,
"upload_time": "2024-09-30T06:19:25",
"upload_time_iso_8601": "2024-09-30T06:19:25.455661Z",
"url": "https://files.pythonhosted.org/packages/cd/7c/1757a26bb8f86a432d9a27cf0de076062d9754d5fbf36b4d51f94437209d/azure-kusto-data-4.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-30 06:19:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Azure",
"github_project": "azure-kusto-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "azure-kusto-data"
}