Nansen Query Documentation
  • Introduction
  • Overview
    • 📍Getting Started
    • 📍Benefits of Curation
  • Data
    • 🗃️Data Sources
    • 🗃️Data Catalog
      • 🗃️Raw Events
      • 🗃️Aggregates
        • Entity Stats
        • Address Stats
        • Token Usage Stats
        • Transaction Stats
        • Address & Their Relationships
      • 🗃️Dex Trades
        • 🗃️Dex Trader P&L
        • 🗃️Dex Trader Use Cases
        • 🗃️Advanced Topics
        • 🗃️Trader P&L FAQ
      • 🗃️Decoded Contracts
      • 🗃️NFTs
      • 🗃️Governance
      • 🗃️Solana
        • 🗃️Solana Aggregates
    • 🗃️Repeated / Nested Fields
    • 🗃️Adding New Projects
    • 🗃️Data Marketplace
  • Web App
    • 🖥️Overview
    • 🖥️Getting Started: Web App
    • 🖥️My Queries
    • 🖥️Query Editor
    • 🖥️Visualizations
    • 🖥️Dashboards
    • 🖥️Dashboard Editor
    • 🖥️Refresh Schedules
    • ⚙️Custom Query APIs
      • ⚙️API Keys
      • ⚙️Execute A Query
      • ⚙️Get Query Results
  • Database Access
    • 📂Database Overview
    • 📂Getting Started: Database
    • 📂Sample Queries
      • 📂Wallet Examples
      • 📂Token Examples
      • 📂Trader P&L
      • 📂Project Examples
      • 📂Solana Queries
      • 📂Blockchain Examples
    • 📂Sample Python Code
      • 📂Wallet Examples
      • 📂Token Examples
    • 📂Cost Optimization
    • 📂Database FAQs
  • Other
    • ⁉️General FAQs
    • 🏷️Wallet Labels
Powered by GitBook
On this page
  • Query Name and Tags
  • Schema Browser
  • Editor Window
  • Parameters
  1. Web App

Query Editor

PreviousMy QueriesNextVisualizations

Last updated 2 years ago

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

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:

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.

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.

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

Nansen Query: Data that is curated and organized by Nansen. See the 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 project and still being used today.

🖥️
data schema
Blockchain-ETL
Query Editor
Example of Invalid SQL
Add New Parameter Button