pax_global_header 0000666 0000000 0000000 00000000064 14772224246 0014524 g ustar 00root root 0000000 0000000 52 comment=535f1fc34b41802f71608b5ca3f74f81bd4ffbc0
azure-kusto-python-5.0.2/ 0000775 0000000 0000000 00000000000 14772224246 0015340 5 ustar 00root root 0000000 0000000 azure-kusto-python-5.0.2/.github/ 0000775 0000000 0000000 00000000000 14772224246 0016700 5 ustar 00root root 0000000 0000000 azure-kusto-python-5.0.2/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14772224246 0021063 5 ustar 00root root 0000000 0000000 azure-kusto-python-5.0.2/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001155 14772224246 0023557 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
#### Code Sample, a copy-pastable example if possible
```python
# Your code here
```
#### Problem description
[this should explain **why** the current behavior is a problem and why the expected output is a better solution.]
#### If query related, does it happen on other platforms (Kusto Web UI, Kusto Explorer)?
[this step is to help pin point problems that are only specific to this platform.]
#### Output of ``pip freeze``
[paste the output of ``pip freeze`` here below this line]
azure-kusto-python-5.0.2/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001123 14772224246 0024605 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
azure-kusto-python-5.0.2/.github/pull_request_template.md 0000664 0000000 0000000 00000000043 14772224246 0023636 0 ustar 00root root 0000000 0000000 ### Added
### Changed
### Fixed
azure-kusto-python-5.0.2/.github/workflows/ 0000775 0000000 0000000 00000000000 14772224246 0020735 5 ustar 00root root 0000000 0000000 azure-kusto-python-5.0.2/.github/workflows/build.yml 0000664 0000000 0000000 00000005677 14772224246 0022576 0 ustar 00root root 0000000 0000000 # This workflow will install the dependencies, run tests and lint every push
name: Python package
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
on:
push:
branches: [ master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
environment: build
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
env:
PYTHON: ${{ matrix.python-version }}
steps:
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip --user
pip install -r dev_requirements.txt --user
pip install pytest-cov --user
pip install ./azure-kusto-data[aio,pandas] ./azure-kusto-ingest[aio,pandas] --user
pip freeze
# We have to use an old version of this plugin, as the new one assumes python 3.8
- uses: psf/black@c8f1a5542c257491e1e093b1404481ece7f7e02c
with:
options: "--check --diff --line-length 160"
version: "23.3.0"
- name: EtoE Test with pytest
env:
TEST_DATABASE: ${{ secrets.TEST_DATABASE }}
TEST_BLOB: ${{ secrets.TEST_BLOB }}
ENGINE_CONNECTION_STRING: ${{ secrets.ENGINE_CONNECTION_STRING }}
APPLICATION_INSIGHTS_ENGINE_CONNECTION_STRING: https://ade.applicationinsights.io/subscriptions/12534eb3-8109-4d84-83ad-576c0d5e1d06/resourcegroups/clients_e2e_test/providers/microsoft.insights/components/kusto-e2e-app-insights
APPLICATION_INSIGHTS_TEST_DATABASE: kusto-e2e-app-insights
run: |
pytest -v . --junit-xml pytest.xml --cov=/home/runner/.local/lib/python${{ matrix.python-version }}/site-packages/azure/kusto --cov-report=xml:coverage2.xml
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (Python ${{ matrix.python-version }})
path: pytest*.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
env_vars: PYTHON
publish-test-results:
name: "Publish Unit Tests Results"
needs: build
runs-on: ubuntu-latest
if: always()
permissions:
checks: write
pull-requests: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: artifacts/**/*.xml
azure-kusto-python-5.0.2/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000005233 14772224246 0024553 0 ustar 00root root 0000000 0000000 # For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '19 11 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# âšī¸ Command-line programs to run using the OS shell.
# đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
azure-kusto-python-5.0.2/.github/workflows/release.yml 0000664 0000000 0000000 00000003145 14772224246 0023103 0 ustar 00root root 0000000 0000000 # This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: release
permissions:
checks: write
pull-requests: write
packages: write
deployments: write
contents: write
id-token: write
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build azure-kusto-data
working-directory: ./azure-kusto-data
run: |
python setup.py sdist bdist_wheel
- name: Build azure-kusto-ingest
working-directory: ./azure-kusto-ingest
run: |
python setup.py sdist bdist_wheel
- name: Publish azure-kusto-data
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: azure-kusto-data/dist
- name: Publish azure-kusto-ingest
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: azure-kusto-ingest/dist
- name: Release
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: azure-kusto-data/dist/*.tar.gz azure-kusto-ingest/dist/*.tar.gz azure-kusto-data/dist/*.whl azure-kusto-ingest/dist/*.whl
azure-kusto-python-5.0.2/.gitignore 0000664 0000000 0000000 00000011677 14772224246 0017344 0 ustar 00root root 0000000 0000000 ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
dist/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
.run/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# Result of running python setup.py install/pip install -e
RECORD.txt
build/
*.egg-info/
# Wheel files
*.whl
*.tar.gz
# pytest temp files
.pytest_cache*
# VS code files
.vscode*
#mypy files
.mypy*
*/.tox/ azure-kusto-python-5.0.2/.pylintrc 0000664 0000000 0000000 00000000132 14772224246 0017201 0 ustar 00root root 0000000 0000000 # https://github.com/getsentry/responses/issues/74
[TYPECHECK]
ignored-classes= responses
azure-kusto-python-5.0.2/CHANGELOG.md 0000664 0000000 0000000 00000013615 14772224246 0017157 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [5.0.2] - 2025-05-30
### Fixed
- Fixed bug in `ingest_from_dataframe` with some ingestion properties combinations.
## [5.0.1] - 2025-03-12
### Fixed
- Dependency issues
## [5.0.0] - 2025-03-10
### Changed
- [BREAKING] Dropped support for python version 3.7, as it is on EOL for over year.
- [BREAKING] Aligned the Connection String Builder keywords with the rest of the SDKs.
This means that some keywords were removed, and they will no longer be parsed as part of the Connection String.
Building the Connection String using the builder method will still work as expected.
The following keywords have been removed:
- `msi_auth` / `msi_authentication`
- `msi_params` / `msi_type`
- `interactive_login`
- `az_cli`
- [BREAKING] `ingest_from_dataframe` - Added `data_format` parameter. It can be None (default), 'json' or 'csv'.
Based on how panda's csv serialization works, dynamic data will not be serialized correctly.
By default, the data will be serialized as json to avoid this issue.
However, that may break if a CSV mapping is used.
Therefore, when passing the None value, the data will be json by default, or csv if a csv mapping is used.
Also, it is possible to pass 'csv' or 'json' to force the serialization type.
## [4.6.3] - 2025-01-08
### Fixed
- Explicitly export members in `__init__.py` via `__all__`
## [4.6.2] - 2025-01-07
### Fixed
- Added `py.typed` markers
- Fixed semantic error handling
## [4.6.1] - 2024-09-30
### Added
- Support more kusto endpoints by default
### Fixed
- Better python errors when getting 401 and other http errors
## [4.5.1] - 2024-06-19
### Fixed
- Fixed bug in `dataframe_from_result_table` with some command results.
## [4.5.0] - 2024-06-18
### Added
- `dataframe_from_result_table` now accepts optional converters for specific columns or types.
### Fixed
- Compatibility with numpy 2.0
## [4.4.1] - 2024-05-06
### Fixed
- Fixed bug in ManagedIdentity close method
- Fixed bug in IngestionResult repr
## [4.4.0] - 2024-04-08
### Added
- Streaming ingestion from blob
### Fixed
- Managed streaming fallback to queued
- Fixed token providers not being closed properly
- Internal test fixes
- Pandas support the new string type, if available
- Removed test folders from wheel
### Changed
- Changed binary files data format compression to false
## [4.3.1] - 2023-12-18
### Fixed
- Pandas now correctly parses all dates
## [4.3.0] - 2023-12-12
### Added
- Added smart retry ability for queued ingestion.
- Support new playfab domain
- Added no-authenticaion option
### Fixed
- Santaize secrets from blob urls
- Correctly handle closing of token providers in async (NOTE: now using async providers in sync clients will correctly
raise an exception)
- Fixed proxy not passing correctly in some cases
- Fixed exception handling in web requests
- Internal fixes for environment variables
- Fixed documentation on E2E tests, and made it possible to test on a clean cluster
## [4.2.0] - 2023-05-18
### Added
- Added Initial Catalog (Default Database) parameter to ConnectionStringBuilder
- Added callback parameter to device code
- Added method to manually set the cache for CloudSettings
### Changed
- Urls with one item after the path (i.e https://test.com/abc) will now be treated as cluster and initial catalog (ie.
the cluster is "https://test.com" and the initial catalog is "abc").
- This is to align our behaviour with the .NET SDK
### Fixed
- Some edge cases in url parsing
- IgnoreFirstRecord now works properly
- Internal code improvement for telemetry
## [4.1.4] - 2023-04-16
### Fixed
- Unicode headers are now espaced using '?', to align with the service
## [4.1.3] - 2023-03-26
### Added
- Add new trident endpoint support
### Security
- Redirects are no longer allowed
## [4.1.2] - 2023-02-22
### Fixed
- Fixed resource parsing to be inline with other SDKs
- More resources are properly closed
- Internal testing fixes
## [4.1.1] - 2023-02-12
### Fixed
- Fixed context not awaited in traces, caused warning
- Fixed setup.py file, #453
## [4.1.0] - 2023-02-09
### Added
- Tracing support for the SDK
- Use opentelemetry to trace the flow of operations when querying or ingesting
- Add support for a TokenProvider to authenticate access.
- KustoConnectionStringBuilder.with_token_provider() /KustoConnectionStringBuilder.with_async_token_provider()
### Fixed
- Use proper np types instead of strings, fixes #447
- samples file was cut short
- Send http headers under the new unified format
### Changed
- Adding Microsoft SECURITY.MD
## [4.0.2] - 2022-12-15
### Added
- Add trident endpoint support
### Fixed
- Added more serialization options for "msi authentication" and "msi params" correctly
- Make error parsing less restrictive to support more errors
## [4.0.1] - 2022-11-30
### Added
- Added flag to handle nullable bools in pandas, fixes #436.
### Fixed
- Fixed source release not including a file.
## [4.0.0] - 2022-11-23
### Added
- [BREAKING] Trusted endpoints validation - by default, kusto will only connect to known endpoints.
- Added closability to the clients
- Make numpy dependency optional by @spektom
- Sample app improvements by @ronmonetaMicro
- Added Ignorefirstrecord ingestion property
- Fixed AttributeError when unpickling HTTPAdapterWithSocketOptions.
- Enum serialization fix
- Internal and testing improvements by @enmoed
### Changed
- Use "organizations" as the default tenant to support more cases
## [3.1.3] - 2022-06-08
### Added
- Allow passing service url with port
- Expanded mappings to support all options for all data formats
### Fixed
- Use "organizations" as the default tenant to support more cases
### Changed
- Docs improvements by @nerd2ninja in #393
azure-kusto-python-5.0.2/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000000674 14772224246 0020146 0 ustar 00root root 0000000 0000000 # Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
azure-kusto-python-5.0.2/CONTRIBUTING.md 0000664 0000000 0000000 00000007702 14772224246 0017577 0 ustar 00root root 0000000 0000000 # Contributing to Azure Python SDK
If you would like to become an active contributor to this project please
follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](https://azure.github.io/azure-sdk/python_documentation.html).
## Prerequisites
In order to run E2E tests, you need a Kusto database you have admin rights on.
A Kusto free cluster is the easiest way to acquire one.
You can cerate a free Kusto cluster here: https://dataexplorer.azure.com/home
Make sure you set streaming ingestion to enabled in the cluster's configuration:
https://learn.microsoft.com/en-us/azure/data-explorer/ingest-data-streaming?tabs=azure-portal%2Ccsharp
You should set then following environment vars where you run E2Es (in IDE run config, shell window, computer, etc).
```shell
ENGINE_CONNECTION_STRING=
DM_CONNECTION_STRING= # Optional - if not set, will infer from ENGINE_CONNECTION_STRING
TEST_DATABASE=
```
The E2E tests authenticate with DefaultAzureCredential, and will fall back to interactive login if needed.
For more information on DefaultAzureCredential, see:
https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
To run the optional `token_provider` tests, you will need to set the booleans at the top of the file `test_token_providers.py` and the following environment variables in addition to the previous ones:
```shell
# app key provider:
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_TENANT_ID=
# certificate provider:
CERT_THUMBPRINT=
CERT_PUBLIC_CERT_PATH=
CERT_PEM_KEY_PATH=
# managed identity provider:
MSI_OBJECT_ID=
MSI_CLIENT_ID=
# user password provider:
USER_NAME=
USER_PASS=
USER_AUTH_ID= # optional
```
## Requirements
In order to work on this project, we recommend using the dev requirements:
```bash
pip install -r dev_requirements.txt
```
These including testing related packages as well as styling ([black](https://black.readthedocs.io/en/stable/))
## Building and Testing
This project uses [pytest](https://docs.pytest.org/en/latest/).
Since the tests use the package as a third-party, the easiest way to set it up is installing it in edit mode:
```bash
pip install -e ./azure-kusto-data ./azure-kusto-ingest
```
After which, running tests is simple.
Just run:
```bash
pytest ./azure-kusto-data ./azure-kusto-ingest
```
## Style
We use black, and allow for line-length of 160, so please run:
```bash
black --line-length=160 ./azure-kusto-data ./azure-kusto-ingest
```
## PRs
We welcome contributions. In order to make the PR process efficient, please follow the below checklist:
* **There is an issue open concerning the code added** - (either bug or enhancement).
Preferably there is an agreed upon approach in the issue.
* **PR comment explains the changes done** - (This should be a TL;DR; as the rest of it should be documented in the related issue).
* **PR is concise** - try and avoid make drastic changes in a single PR. Split it into multiple changes if possible. If you feel a major change is needed, it is ok, but make sure commit history is clear and one of the maintainers can comfortably review both the code and the logic behind the change.
* **Please provide any related information needed to understand the change** - docs, guidelines, use-case, best practices and so on. Opinions are accepted, but have to be backed up.
* **Checks should pass** - these including linting with black and running tests.
## Code of Conduct
This project's code of conduct can be found in the
[CODE_OF_CONDUCT.md file](https://github.com/Azure/azure-sdk-for-python/blob/master/CODE_OF_CONDUCT.md)
(v1.4.0 of the http://contributor-covenant.org/ CoC).
azure-kusto-python-5.0.2/LICENSE 0000664 0000000 0000000 00000002212 14772224246 0016342 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
azure-kusto-python-5.0.2/README.md 0000664 0000000 0000000 00000012405 14772224246 0016621 0 ustar 00root root 0000000 0000000 # Microsoft Azure Kusto (Azure Data Explorer) SDK for Python
[*azure-kusto-data*]("https://github.com/Azure/azure-kusto-python/tree/master/azure-kusto-data") Package provides the capability to query Kusto clusters with Python.
[](https://badge.fury.io/py/azure-kusto-data)
[](https://pepy.tech/project/azure-kusto-data)
[*azure-kusto-ingest*]("https://github.com/Azure/azure-kusto-python/tree/master/azure-kusto-ingest") Package allows sending data to Kusto service - i.e. ingest data.
[](https://badge.fury.io/py/azure-kusto-ingest)
[](https://pepy.tech/project/azure-kusto-ingest)
## Install
### Option 1: Via PyPi
To install via the Python Package Index (PyPI), type:
* `pip install azure-kusto-data`
* `pip install azure-kusto-ingest`
### Option 2: Source Via Git
To get the source code of the SDK via git just type:
```python
git clone https://github.com/Azure/azure-kusto-python
cd ./azure-kusto-python/azure-kusto-data
python3 setup.py install
cd ../azure-kusto-ingest
python3 setup.py install
```
### Option 3: Source Zip
Download a zip of the code via GitHub or PyPi. Then follow the same instructions in option 2.
### Optionals:
* [_Pandas_](http://pandas.pydata.org/) - Package provides extra functionality for use with pandas. Since these are optional dependencies, install with pandas:
* `pip install azure-kusto-data[pandas]`
* `pip install azure-kusto-ingest[pandas]`
## Minimum Requirements
* Python 3.5 and above
* See setup.py for dependencies
## Authentication methods:
* AAD Username/password - Provide your AAD username and password to Kusto client (**check the notice below**).
* AAD application - Provide app ID and app secret to Kusto client.
* AAD code - Provide only your AAD username, and authenticate yourself using a code, generated by ADAL.
* AZ CLI - For those already using [azure-cli](https://github.com/Azure/azure-cli), provide access token for the logged in user`.
** IMPORTANT NOTICE **:
User authentication (using username and password) has a major caveat:
Sometimes users are required to use Multi-Factor Authentication. In such a case, this flow won't work for them.
It is a limitation of the AAD library we are using under the hood. There are [several bugs reported](https://github.com/AzureAD/azure-activedirectory-library-for-python/issues?utf8=%E2%9C%93&q=is%3Aissue+mfa).
There is also a feature request for the adal team to work on implementing IWA (Intergrated Windows Auth) so that signed in users won't have to authenticate. Feel free to [upvote](https://github.com/AzureAD/microsoft-authentication-library-for-python/issues/31) if it is relevant in your case.
## Samples:
* [Kusto Quick Start Sample App](https://github.com/Azure/azure-kusto-python/tree/master/quick_start)
* [Kusto query sample snippets](https://github.com/Azure/azure-kusto-python/blob/master/azure-kusto-data/tests/sample.py)
* [Data ingest sample snippets](https://github.com/Azure/azure-kusto-python/blob/master/azure-kusto-ingest/tests/sample.py)
## Best Practices
See the SDK [best practices guide](https://docs.microsoft.com/azure/data-explorer/kusto/api/netfx/kusto-ingest-best-practices), which though written for the .NET SDK, applies similarly here.
## Need Support?
- **Have a feature request for SDKs?** Please post it on [User Voice](https://feedback.azure.com/forums/915733-azure-data-explorer) to help us prioritize
- **Have a technical question?** Ask on [Stack Overflow with tag "azure-data-explorer"](https://stackoverflow.com/questions/tagged/azure-data-explorer)
- **Need Support?** Every customer with an active Azure subscription has access to [support](https://docs.microsoft.com/en-us/azure/azure-supportability/how-to-create-azure-support-request) with guaranteed response time. Consider submitting a ticket and get assistance from Microsoft support team
- **Found a bug?** Please help us fix it by thoroughly documenting it and [filing an issue](https://github.com/Azure/azure-kusto-python/issues/new).
## Looking for SDKs for other languages/platforms?
- [Node](https://github.com/azure/azure-kusto-node)
- [Java](https://github.com/azure/azure-kusto-java)
- [.NET](https://docs.microsoft.com/en-us/azure/kusto/api/netfx/about-the-sdk)
- [Go](https://github.com/Azure/azure-kusto-go)
# Contribute
We gladly accept community contributions.
- Issues: Please report bugs using the Issues section of GitHub
- Forums: Interact with the development teams on StackOverflow or the Microsoft Azure Forums
- Source Code Contributions: If you would like to become an active contributor to this project please follow the instructions provided in [Contributing.md](CONTRIBUTING.md).
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
For general suggestions about Microsoft Azure please use our [UserVoice forum](http://feedback.azure.com/forums/34192--general-feedback).
azure-kusto-python-5.0.2/SECURITY.md 0000664 0000000 0000000 00000005305 14772224246 0017134 0 ustar 00root root 0000000 0000000
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
azure-kusto-python-5.0.2/azure-kusto-data/ 0000775 0000000 0000000 00000000000 14772224246 0020540 5 ustar 00root root 0000000 0000000 azure-kusto-python-5.0.2/azure-kusto-data/MANIFEST.in 0000664 0000000 0000000 00000000233 14772224246 0022274 0 ustar 00root root 0000000 0000000 include *.rst
include azure/__init__.py
include azure/kusto/data/wellKnownKustoEndpoints.json
include azure/kusto/data/kcsb.json
recursive-exclude tests *
azure-kusto-python-5.0.2/azure-kusto-data/README.rst 0000664 0000000 0000000 00000005762 14772224246 0022241 0 ustar 00root root 0000000 0000000 Microsoft Azure Kusto Library for Python
========================================
Overview
--------
.. code-block:: python
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder
cluster = ""
client_id = ""
client_secret = ""
authority_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
`_.
which are attached to Spark clusters,
including, but not exclusively, `Azure 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 = ""
client_id = ""
client_secret = ""
authority_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 `_.
* `Kusto query sample `_.
* `GitHub Repository `_.
azure-kusto-python-5.0.2/azure-kusto-data/azure-kusto-data.iml 0000664 0000000 0000000 00000001417 14772224246 0024446 0 ustar 00root root 0000000 0000000