Python
1. Setup
The Python query runner lets you run arbitrary Python 3 scripts and visualize the contents of a result
variable declared in the script. For security, is disabled by default.
You can create a Python data source from Settings > Data Sources.
Modules to import prior to running the script lets you define which modules that were installed by
pip
on the host server may be import in the application queries.AdditionalModulesPaths is a comma-separated list of absolute paths on the server to Python modules that should be available when querying from the application. This is useful for private modules that are not available from
pip
.AdditionalBuiltins the application automatically allows twenty-five of Python’s built-in functions that are considered safe. You can specify others here.
These are the default built-ins: abs
, all
, any
, bool
, complex
, dict
, divmod
, enumerate
, filter
, float
, int
, len
, list
, map
, max
, min
, next
, reversed
, round
, set
, slice
, sorted
, str
, sum
, tuple
Furthermore, please note that certain basic modules such as json, web3, pandas, requests, and logging are also pre-loaded to facilitate the execution of your scripts.
2. Writing Queries
The application builds the result table by inspecting the final state of your script execution for a variable named result
.
result
should follow this example format:
If you execute the above snippet, it will return this table:
Last updated