Templating
Jinja Templating
We use Jinja templating to construct dynamic queries, allowing flexible adjustments tailored to your data model.
Jinja allows:
Loops (
for
) → Automate query generation for multiple signals.Conditions (
if
) → Add optional calculations dynamically.
For example, for retreiving Second Cursor Statistics in ADX, we would use the following query:
Template Constants
Marple allows you to substitute variables in query templates using Jinja syntax.
These variables fall into three categories: constants, dataset filters, and query-specific variables.
Constants are predefined values that can be referenced in queries as
{{CONSTANT_NAME}}
. You can define these constants within the configuration.Dataset filters are determined by the filter signals in your dataset definition. For example, if
session
is part of the filter list, it can be used in queries as{{dataset.session}}
.Query-specific variables are defined per query and vary based on its purpose. For instance, a time series query might use
{{timestamp_start}}
and{{timestamp_stop}}
to define the time range.
This approach ensures dynamic and flexible queries that adapt to different datasets while maintaining clarity and efficiency.
Last updated