Skip to main content

Wrapper around azure-kusto client to facilitate bringing BIG query results while avoiding hitting the limits

Project description

big-query-kusto-client

Package to facilitate the gathering of big datasets from Azure Data Explorer by paginating

Usage

from bigquerykustoclient import BigQueryKustoClient

# Resolve the KQL client how ever you see fit
kusto = build_kusto_client()

# pass it on the constructor
# and much better using with:

with BigQueryKustoClient(kusto) as client:
    df: pandas.DataFrame = client.execute_query(
        db='ContosoSales',
        query= 'SaltesTable | order by DateKey, ProductKey, CustomerKey',
        optimal_page=True
    )

len(df)  # Will give you the amount of rows it broght for you

Important Note

For this to work it is required that the query imposes an order on the results, no matter what column you use but an | order by operator must be in the query.

Other considerations

The package uses this other values from the system for its configuration. It tries to keep sensible defaults:

ADX_RECORDS_LIMIT=500000  # Limit of amount of rows in ADX
ADX_SIZE_IN_BYTES_LIMIT=67108864  # 64MB limit of size of result
BQKC_PAGE_SIZE=100000  # Default pagesize that we'll use to paginate the results
BQKC_SQ_PREFIX=BigQueryKustoClient  # A prefix that will be used as namespace for the queries

BQKC_PAGE_SIZE will get overridden if the parameter optimal_page=True is used. When done so, the pacakge will try to determine the biggest possible size of page to use.

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

big_query_kusto_client-0.2.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

big_query_kusto_client-0.2.1-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page