# Azure Data Explorer (ADX)

Marple integrates seamlessly with [ADX](https://dataexplorer.azure.com/publicfreecluster), a powerful time-series database optimised for large-scale telemetry data.&#x20;

### Required credentials

To connect, the following credentials are needed:

```json
// example
{
    "appId": "8aa131d-dac5-429d-ada2-95adbc83b",
    "appKey": "anv8Q~TJ6ubna15TCi.wAg9015EcDL",
    "tenantId": "11344e0f-83d3-4b52-9a38-a6bbb1a360a4",
    "dbName": "my-adx-database",
    "dbHost": "https://myadxdatabase.westeurope.kusto.windows.net"
}
```

### Queries

Queries are executed using [Kusto Query Language (KQL)](https://learn.microsoft.com/en-us/kusto/query/). Marple offers predefined queries for fetching datasets, signals, and time-series data. Below are some example queries:

* To retrieve **datasets**:

```kusto
{{TABLE}}
{%- for key, values in metadata.items() %}
| where {{key}} in ('{{values|join("', '")}}')
{% endfor %}
| summarize
    timestamp_start = min({{TIME_COLUMN}}),
    timestamp_stop  = max({{TIME_COLUMN}}),
    by session, car, outing
| extend 
    display_name = strcat(session, ' | ', car, ' | ', outing), 
    realtime = (['acquisition type'] == 'Telemetry' and unixtime_seconds_todatetime(timestamp_stop) > ago(1m))
```

* To retrieve a **signal list:**

```kusto
{{TABLE}}
| where outing == '{{dataset.outing}}'
| summarize ['count'] = count()
    by name=signal
```

* To retrieve the **time series data**

```kusto
{{TABLE}}
| where outing == '{{dataset.outing}}'
| where {{timestamp_start}} <= timestamp
| where {{timestamp_stop}} >= timestamp
| where signal == '{{signal.name}}'
| project name = signal, timestamp = timestamp, value = toreal(value)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.marpledata.com/docs/marple-insight/setup-and-configuration/data-connection/supported-databases/azure-data-explorer-adx.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
