🖥️

Query Editor

The Query Editor is used to browse datasets, compose queries, validate query results, create visualizations, and save a query for future reuse.
Query Editor

Query Name and Tags

In the upper left section of the Query Editor is the name of the query and any tags associated with the query. By default, the name is "New Query" without any tags.
To change the name of a query, click on the current name and type in a new name.
To add a tag to this query, click on the Add Tag button and select from an existing list of tags or create a new one.

Schema Browser

The schema browser consists of the following:
  • A data source selector
  • A search bar
  • A list of available schema
The Data Source Selector allows the user to switch between different datasets. Currently, Nansen Query host two types of datasets:
  • Nansen Query: Data that is curated and organized by Nansen. See the data schema section for details. Depending on your access level, you may see Trial, Basic or Advanced datasets.
  • Blockchain-ETL: Decoded smart contract events. This repo is from the original Blockchain-ETL project and still being used today.
In addition to manually browsing through the schema list, users can also Search by table or column name by typing in the search term in the search bar.
Depending on the data source selected and the search term, a list of available schema will be listed. The schema information shown include names of tables and for each table, the columns available. In the future, additional information will be available in the schema browse, such as the data type, the associated blockchain, etc...

Editor Window

The editor is a free text editor with color coding for SQL commands. In the background, Nansen Query is constantly checking the validity of the commands and will prompt the user if the SQL is invalid.
Example of Invalid SQL

Parameters

For generic dashboards or queries, it is possible to use a parameter to simplify maintenance increase reusability.
In the example below, a parameter was created to specify how many rows a SQL query should return. By inserting the {{nof_row}} parameter code into the SQL statement and using 786 as the parameter value, we were able to limit the rows returned from the SQL to 786 rows.
To create a parameter, click on the "Add New Parameter" icon below the Query Editor.
Add New Parameter Button
A popup will appear with inputs required to create a parameter. The inputs are:
  • Keyword: a text string that will appear in the SQL code, like {{nof_row}} from the example above
  • Title: Description for the parameter
  • Type: The value that the parameter is suppose to represent:
    • Text - a string, such as name or token address
    • Number - Top N results or greater than N dollar or tokens
    • Dropdown List - Used to restrict the query to specific, static values
    • Query Based Dropdown List - A dynamic version of the Dropdown, based on another query
    • Date: A date value
    • Date and Time: A date value with time (time stamp)
Once a parameter has been created, place the parameter where it would normally appear in the SQL query. In the example below, it's been placed after LIMIT