In one of our previous blog posts we have shown you a quick sneak peek into our PQL query builder. In this guide we want to dive deeper into PQL and PQL query editor. We will guide you through the basic UI elements. In the next blog post we will create an example query.
Query builder or query editor comes as standard with the Paralink Node. It allows you to test and publish PQL definitions. PQL definitions represent ETL (extract, transform, load) pipelines for sourcing, aggregating and validating information. They are the basis of oracle requests (jobs).
Query Editor User Interface
The Query Editor was designed to be easy to use. The whole interface is divided in two parts:
- Main area (code editor and results area)
- Definitions area (for editing loaders, operators and aggregators)
In the main area you can toggle between code editor and results by clicking the first toggle button as show below.
Next button on the right is the “Save” button (saves your project into 32-bit hash).
Next to it is “Build” button. By inserting a code into the code editor, the Build function will generate your definitions (in the definitions area).
By hitting the “Compile” button you compile the PQL and update its JSON code.
To run your query you must hit the “Run” button and the results will be shown in the main area.
PQL query is built with different Loaders, Operators and Aggregators. Let’s go through each one individually.
With loaders data can be loaded from HTTP requests, Postgres or Ethereum blockchain.
You can add a loader by clicking this button.
When adding a new loader you have multiple options to choose from. We will use “Http Get” option in our example in the next blog post.
With operators, we can extract specific data from the retrieved data for example. To do that we have to add a traverse operator. To add a new operator you have to click the “Add operator” button.
Operators are draggable. You can drag each operator into the desired location or spot.
Aggregators allow us to aggregate information from multiple data sources using mean, median or mode. It also supports basic math operations such as +, -, *, /, %. Before you can aggregate data, you must have multiple sources (loaders).
To aggregate data from different sources click the “Aggregate” button and select the preferred method.
That’s it! We believe our PQL Query Editor is very simple, but let us know what you think. You can join our official Discord server where we have a dedicated channel for developers. You can join here:
The best way to familiarize yourself with the UI is to build an example query. We will do that in our next blog post where we will aggregate the Bitcoin price in USD from different source.