summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-pykusto.spec343
-rw-r--r--sources1
3 files changed, 345 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..3e99993 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pykusto-0.2.0.tar.gz
diff --git a/python-pykusto.spec b/python-pykusto.spec
new file mode 100644
index 0000000..8011ae7
--- /dev/null
+++ b/python-pykusto.spec
@@ -0,0 +1,343 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pykusto
+Version: 0.2.0
+Release: 1
+Summary: Advanced python SDK for Azure Data Explorer
+License: MIT License
+URL: https://github.com/Azure/pykusto
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/89/04/bbed59d5e6983563707fafe81f889769bd4344d7e4a1af40debdfacd980a/pykusto-0.2.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-redo
+Requires: python3-azure-kusto-data
+Requires: python3-pandas
+Requires: python3-pytest
+Requires: python3-pytest-cov
+Requires: python3-flake8
+Requires: python3-typeguard
+
+%description
+# Introduction
+_pykusto_ is an advanced Python SDK for Azure Data Explorer (a.k.a. Kusto).
+Started as a project in the 2019 Microsoft Hackathon.
+
+[![PyPI version](https://badge.fury.io/py/pykusto.svg)](https://badge.fury.io/py/pykusto)
+[![Downloads](https://pepy.tech/badge/pykusto)](https://pepy.tech/project/pykusto)
+
+# Getting Started
+### Installation
+Default installation:
+```bash
+pip install pykusto
+```
+With dependencies required for running the tests:
+```bash
+pip install pykusto[test]
+```
+Without dependencies which are not needed in PySpark:
+```bash
+pip install pykusto --global-option pyspark
+```
+
+
+### Basic usage
+
+```python
+from datetime import timedelta
+from pykusto import PyKustoClient, Query
+
+# Connect to cluster with AAD device authentication
+# Databases, tables, and columns are auto-retrieved
+client = PyKustoClient('https://help.kusto.windows.net')
+
+# Show databases
+print(tuple(client.get_databases_names()))
+
+# Show tables in 'Samples' database
+print(tuple(client.Samples.get_table_names()))
+
+# Connect to 'StormEvents' table
+t = client.Samples.StormEvents
+
+# Build query
+(
+ Query(t)
+ # Access columns using table variable
+ .project(t.StartTime, t.EndTime, t.EventType, t.Source)
+ # Specify new column name using Python keyword argument
+ .extend(Duration=t.EndTime - t.StartTime)
+ # Python types are implicitly converted to Kusto types
+ .where(t.Duration > timedelta(hours=1))
+ .take(5)
+ # Output to pandas dataframe
+ .to_dataframe()
+)
+```
+
+### Retrying failed queries
+```python
+# Turn on retrying for all queries
+from pykusto import PyKustoClient, RetryConfig, Query
+
+client = PyKustoClient(
+ "https://help.kusto.windows.net",
+ retry_config=RetryConfig() # Use default retry config
+)
+
+# Override retry config for specific query
+Query(client.Samples.StormEvents).take(5).to_dataframe(
+ retry_config=RetryConfig(attempts=3, sleep_time=1, max_sleep_time=600, sleep_scale=2, jitter=1)
+)
+```
+
+# Contributing
+
+This project welcomes contributions and suggestions. Most contributions require you to agree to a
+Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
+the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
+
+When you submit a pull request, a CLA bot will automatically determine whether you need to provide
+a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
+provided by the bot. You will only need to do this once across all repos using our CLA.
+
+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.
+
+
+
+
+%package -n python3-pykusto
+Summary: Advanced python SDK for Azure Data Explorer
+Provides: python-pykusto
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pykusto
+# Introduction
+_pykusto_ is an advanced Python SDK for Azure Data Explorer (a.k.a. Kusto).
+Started as a project in the 2019 Microsoft Hackathon.
+
+[![PyPI version](https://badge.fury.io/py/pykusto.svg)](https://badge.fury.io/py/pykusto)
+[![Downloads](https://pepy.tech/badge/pykusto)](https://pepy.tech/project/pykusto)
+
+# Getting Started
+### Installation
+Default installation:
+```bash
+pip install pykusto
+```
+With dependencies required for running the tests:
+```bash
+pip install pykusto[test]
+```
+Without dependencies which are not needed in PySpark:
+```bash
+pip install pykusto --global-option pyspark
+```
+
+
+### Basic usage
+
+```python
+from datetime import timedelta
+from pykusto import PyKustoClient, Query
+
+# Connect to cluster with AAD device authentication
+# Databases, tables, and columns are auto-retrieved
+client = PyKustoClient('https://help.kusto.windows.net')
+
+# Show databases
+print(tuple(client.get_databases_names()))
+
+# Show tables in 'Samples' database
+print(tuple(client.Samples.get_table_names()))
+
+# Connect to 'StormEvents' table
+t = client.Samples.StormEvents
+
+# Build query
+(
+ Query(t)
+ # Access columns using table variable
+ .project(t.StartTime, t.EndTime, t.EventType, t.Source)
+ # Specify new column name using Python keyword argument
+ .extend(Duration=t.EndTime - t.StartTime)
+ # Python types are implicitly converted to Kusto types
+ .where(t.Duration > timedelta(hours=1))
+ .take(5)
+ # Output to pandas dataframe
+ .to_dataframe()
+)
+```
+
+### Retrying failed queries
+```python
+# Turn on retrying for all queries
+from pykusto import PyKustoClient, RetryConfig, Query
+
+client = PyKustoClient(
+ "https://help.kusto.windows.net",
+ retry_config=RetryConfig() # Use default retry config
+)
+
+# Override retry config for specific query
+Query(client.Samples.StormEvents).take(5).to_dataframe(
+ retry_config=RetryConfig(attempts=3, sleep_time=1, max_sleep_time=600, sleep_scale=2, jitter=1)
+)
+```
+
+# Contributing
+
+This project welcomes contributions and suggestions. Most contributions require you to agree to a
+Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
+the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
+
+When you submit a pull request, a CLA bot will automatically determine whether you need to provide
+a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
+provided by the bot. You will only need to do this once across all repos using our CLA.
+
+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.
+
+
+
+
+%package help
+Summary: Development documents and examples for pykusto
+Provides: python3-pykusto-doc
+%description help
+# Introduction
+_pykusto_ is an advanced Python SDK for Azure Data Explorer (a.k.a. Kusto).
+Started as a project in the 2019 Microsoft Hackathon.
+
+[![PyPI version](https://badge.fury.io/py/pykusto.svg)](https://badge.fury.io/py/pykusto)
+[![Downloads](https://pepy.tech/badge/pykusto)](https://pepy.tech/project/pykusto)
+
+# Getting Started
+### Installation
+Default installation:
+```bash
+pip install pykusto
+```
+With dependencies required for running the tests:
+```bash
+pip install pykusto[test]
+```
+Without dependencies which are not needed in PySpark:
+```bash
+pip install pykusto --global-option pyspark
+```
+
+
+### Basic usage
+
+```python
+from datetime import timedelta
+from pykusto import PyKustoClient, Query
+
+# Connect to cluster with AAD device authentication
+# Databases, tables, and columns are auto-retrieved
+client = PyKustoClient('https://help.kusto.windows.net')
+
+# Show databases
+print(tuple(client.get_databases_names()))
+
+# Show tables in 'Samples' database
+print(tuple(client.Samples.get_table_names()))
+
+# Connect to 'StormEvents' table
+t = client.Samples.StormEvents
+
+# Build query
+(
+ Query(t)
+ # Access columns using table variable
+ .project(t.StartTime, t.EndTime, t.EventType, t.Source)
+ # Specify new column name using Python keyword argument
+ .extend(Duration=t.EndTime - t.StartTime)
+ # Python types are implicitly converted to Kusto types
+ .where(t.Duration > timedelta(hours=1))
+ .take(5)
+ # Output to pandas dataframe
+ .to_dataframe()
+)
+```
+
+### Retrying failed queries
+```python
+# Turn on retrying for all queries
+from pykusto import PyKustoClient, RetryConfig, Query
+
+client = PyKustoClient(
+ "https://help.kusto.windows.net",
+ retry_config=RetryConfig() # Use default retry config
+)
+
+# Override retry config for specific query
+Query(client.Samples.StormEvents).take(5).to_dataframe(
+ retry_config=RetryConfig(attempts=3, sleep_time=1, max_sleep_time=600, sleep_scale=2, jitter=1)
+)
+```
+
+# Contributing
+
+This project welcomes contributions and suggestions. Most contributions require you to agree to a
+Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
+the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
+
+When you submit a pull request, a CLA bot will automatically determine whether you need to provide
+a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
+provided by the bot. You will only need to do this once across all repos using our CLA.
+
+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.
+
+
+
+
+%prep
+%autosetup -n pykusto-0.2.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-pykusto -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..c50c838
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+532adc659ea6f476cad2b7ea13811629 pykusto-0.2.0.tar.gz