Menu

Query KairosDB from Python and Load Results into a Spark DataFrame
📰

Query KairosDB from Python and Load Results into a Spark DataFrame

DEV Community: python·Fernando Paladini·3 days ago
#8DxFQk6p
#devtopython#devto#dev#kairosdb#query
Long article (1484 words) — no AI summary yet.
Reading 0:00
15s threshold

Time-series data is useful only when it can move from storage into the tools that analyze it. KairosDB exposes a REST query endpoint, while Apache Spark gives you DataFrames for filtering and aggregation. The small open-source pySpark-connector-kairosdb project connects those two pieces with a minimal Python API.

This tutorial shows the smallest useful path: build a KairosDB query, send it through the connector, and understand how its Dataframe adapter turns the response into Spark-readable JSON. It also treats the project as it exists today. The repository describes itself as an alpha module, has no release tag, declares version 0.1.0 , and leaves important dependencies to the user.

TL;DR

sconnk.Connection posts a JSON query to /api/v1/datapoints/query and returns the decoded response. sconnk.Dataframe then reduces KairosDB results into newline-delimited JSON and asks Spark SQL to read data.json . The client path is easy to verify locally with a mock HTTP endpoint.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.