Skip to main content

streaming-kql

Evaluate Kusto Query Language (KQL) over a stream of independent events. Pure Python, no external runtime.

Existing ways to run KQL need a cloud service, a local container, a .NET engine, or a JVM. streaming-kql runs KQL entirely in-process in Python. Each input event is evaluated independently, while operators can expand it into a bounded row set, aggregate or reorder those rows, and combine constant, subquery, and named tables within that event's execution context.

Status: alpha. The engine supports row, expansion, aggregation, ordering, branching, and bounded table-combination operators, including summarize, join, union, mv-apply, make-series, and the tabular case extension. Processing remains stateless across input events. See the full specification and supported KQL reference.

Install

pip install streaming-kql
# dev:
pip install -e ".[dev]"

Quickstart

import streaming_kql as kql

q = kql.compile("source | where Price > 80 | extend Note = strcat(Symbol, ' high')")

q.match({"Symbol": "MSFT", "Price": 90})
# {'Symbol': 'MSFT', 'Price': 90, 'Note': 'MSFT high'}

q.match({"Symbol": "MSFT", "Price": 10})
# None   (filtered out)

# stream any iterable of records; each input yields 0..N outputs
for out in q.stream(events):
    ...

Run many standing queries over one feed:

node = kql.Node()
node.add("high", "source | where Price > 80")
node.add("low",  "source | where Price < 10 | project Symbol, Price")
for query_name, record in node.push(event):
    ...

Register custom functions:

@kql.function("domain_of")
def domain_of(email: str) -> str:
    return email.split("@", 1)[-1]

kql.compile("source | extend d = domain_of(From)")

Documentation

Full developer documentation lives in docs/:

Supported KQL

The baseline is the full Azure Monitor transformations (DCR) KQL surface. Beyond it, the engine supports per-event row sets and bounded tables: one input event can produce zero to many rows, and batch operators act on those rows without carrying state to the next event. See Supported KQL for the authoritative list.

Route each row through the first matching sub-pipeline with the tabular case extension. The final sub-pipeline is the required default:

source
| case (
    Severity >= 4, (project Alert = Message),
    Severity >= 2, (project Warning = Message),
    (project Info = Message)
)

Tests

Conformance tests are data-driven: add a tests/cases/**/*.yaml file with a query, input records, and expect records (or expect_error) — it is discovered automatically.

pytest

License

Apache-2.0. Design and initial evaluator are informed by Microsoft's Apache-2.0 Rx.KQL; see NOTICE.

Metadata

Release files for streaming-kql 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streaming-kql 0.0.2
File Size Uploaded
streaming_kql-0.0.2.tar.gz 87.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streaming-kql 0.0.2
File Interpreter ABI Platform
streaming_kql-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 131.8 kB

Release files / streaming_kql-0.0.2.tar.gz

Download URL streaming_kql-0.0.2.tar.gz
Size 87.3 kB
Tags Source
SHA-256 checksum
How to use checksums
052f7211b38b9aaae9689885329dbc1a8ca025fbd8c124c19044f8bcd41c8c11
BLAKE2b-256 checksum
How to use checksums
531a3f8204bfa286e8886e951f36b55fa0444e5acc947f4815428cdceba17eb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / streaming_kql-0.0.2-py3-none-any.whl

Download URL streaming_kql-0.0.2-py3-none-any.whl
Size 44.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9837771f280b1c564f6a5ba69dacf5e04dbcee339f5a7063ece0b1036e9f507
BLAKE2b-256 checksum
How to use checksums
024112370f991f3315500efb60a8feb094ec3304cd70375b205760201b2635da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page