Python Editor Console
Introduction
This document provides detailed guidelines on using the integrated Python editor console within our platform. The editor is pre-configured with essential libraries and functionalities to assist in executing Python scripts effectively, particularly for data querying and handling secrets.
Where is our Python Editor Console ?
In the Create Metric Page, on the top left side of the page, you can see the icon "</>". Click on it to access our python editor console.
Pre-installed Libraries
Requests Module: The
requests
library is readily available and pre-imported for HTTP requests. You do not need to import it again in your scripts.
Working with Variables
To integrate dynamic data within your scripts, you can utilize predefined variables and data structures:
Client ID: Use the variable
client_id
which should be a string representing the client identifier.Metric Filters: This variable
metric_filters
allows for the filtering of data based on various criteria. The structure ofmetric_filters
is defined as follows:The
metric_filters
variable can include filters of types STRING, DATE, and NUMBER, uniquely identified by a filter name:STRING: A plain string value.
DATE: A dictionary containing
startDate
andendDate
, both ofdatetime.date
type.NUMBER: An integer value.
Handling Secrets
Secrets are stored and accessed via the secrets
dictionary. This allows secure storage and retrieval of sensitive data such as API keys or database credentials: You can set up your secrets in the Home Page → Settings Tab → Secrets.
Storing Results
To store or output data from your script, assign your data to the result
variable. This variable should be an array of objects (or a list of dictionaries in Python terms):
Usage Example
Here’s are some quick examples demonstrating how to utilize these capabilities:
This guide should help you effectively utilize the Python editor console for your data handling needs. The capabilities outlined here are designed to enhance the security, flexibility, and efficiency of your data manipulation tasks.
Last updated