Parser series (Part 2): How to access your data through Metabase

  1. What is Unmarshal Parser?
  2. Parser series (Part 1): Setting Up your own Indexer Using Unmarshal Parser

Understanding the structure of your data

  • When you create your parser you are asked to enter the database name in which your data is to be indexed. The database name corresponds to a schema in Postgres.
Fig. 1.1 Parser form highlighting the database name field
  • Don’t remember the name you gave? The name of the schema where your parser is writing data can be found under the View details section.
Fig 1.2 Parser listing screen view details section
Fig 1.3 Schema name in the parser View details window
  • The data of each of the contract events/functions selected for indexing(at the time of parser creation) is saved into corresponding tables.

Table nomenclature

  • All of the table names are in snake case and are postfixed with _events and _methods for event and function tables respectively.
  1. Events: Approval, Transfer
  2. Functions: transferFrom
  1. Event tables: approval_events, transfer_events
  2. Function tables: transfer_from_methods

Logging in to Metabase

TL;DR

Detailed steps

  • Click on the View details in the Metabase Add-On
Fig. 1.4 Metabase add-on view details section
Fig. 1.5 URL in Metabase View details window
  • Use the above credentials to log into Metabase
  • And just like that, you are one step closer to curating information from the data collected by your parser

Getting used to Metabase

Terminology

Fig. 1.6 Metabase homepage highlighting sections

Data (1)

Fig. 1.7 Browse data screen within Metabase
  1. This section serves as a GUI client for the data collected for your indexers.
  2. On clicking browse data, you get a data source with your Unmarshal console username. (Fig. 1.7)
  3. Digging a little deeper into the data source with your username, you see one of two.
  4. The tables in the data source if, you only have a single schema in which a parser is deployed. Metabase defaults the view to the only available schema.
  5. A list of available schemas across which your parsers have indexed the data. (Fig 1.8)
  6. In our case, we have deployed multiple parsers from our account in different schemas and hence we see a list of schemas.
  7. Within each of the schemas, you have your data tables as described before. (Fig 1.9)
  8. Here is the table structure within our marsh_erc20_parser schema.
  9. This section in Metabase helps you give a nice overview of the data you are working with.
Fig 1.8 Schemas available in your data source
Fig 1.9 Table structure within the marsh_erc20_parser schema

Questions and SQL (2)

  1. More often than not, you would want to curate specific information from the data tables.
  2. To do this you could either choose to write a custom SQL query or you could use the query builder abstraction which Metabase provides also known as Question.
  3. SQL is a powerful yet relatively simple data access abstraction to work with. If you are unfamiliar with it there is tons of documentation and guides available to help you out. (As we save your data in a Postgres database, be sure to refer to related documentation)
  4. Given that you have become familiar with SQL, writing your first query might still need some help given the hierarchy of schemas and data tables, we will get to this in a moment.
  5. Metabase also lets you visualise the results of Questions/SQL queries in different forms like pie charts, tables, line graphs, bar graphs, etc.

Card (3)

  1. A card symbolises a saved question or SQL query along with its visualisation settings.

Dashboard (4)

  1. A dashboard is a single page within which multiple cards can be embedded into.
  2. The cards can be resized and moved around to increase the readability of your curated cards.
  3. Apart from having login limited access to the dashboard, the dashboard could also be made public.

Collection (5)

  1. This is a grouping feature in Metabase that lets the users aggregate data based on logical affinity.
  2. By default, you have access to Our analytics, a collection where all of the public dashboards reside and Your personal collection where all sub-collections which only you have access to reside.
  3. As hinted at in the previous point, you can have nested collections in Metabase, which lets you better group your information.

Querying your data through SQL

Fig. 1.10 SQL query editor on Metabase

Query

​​SELECT count(id) transfer_count,sum(value::numeric)/1e18 transfer_volumeFROM marsh_erc20_parser.transfer_eventsWHERE block_timeBETWEEN timestamp ‘2022–02–07’AND timestamp ‘2022–02–08’;

Challenge

  1. Create a collection in your personal collection
  2. Create your first query
  3. Save your query as a Card
  4. Create a dashboard
  5. Play around and make it as informative as possible

Advanced level

Cross schema querying

Making dashboards public

About Unmarshal

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Unmarshal

Unmarshal

Blockchain data indexer and api provider