Book Image

Metabase Up and Running

By : Tim Abraham
Book Image

Metabase Up and Running

By: Tim Abraham

Overview of this book

Metabase is an open source business intelligence tool that helps you use data to answer questions about your business. This book will give you a detailed introduction to using Metabase in your organization to get the most value from your data. You’ll start by installing and setting up Metabase on your local computer. You’ll then progress to handling the administration aspect of Metabase by learning how to configure and deploy Metabase, manage accounts, and execute administrative tasks such as adding users and creating permissions and metadata. Complete with examples and detailed instructions, this book shows you how to create different visualizations, charts, and dashboards to gain insights from your data. As you advance, you’ll learn how to share the results with peers in your organization and cover production-related aspects such as embedding Metabase and auditing performance. Throughout the book, you’ll explore the entire data analytics process—from connecting your data sources, visualizing data, and creating dashboards through to daily reporting. By the end of this book, you’ll be ready to implement Metabase as an integral tool in your organization.
Table of Contents (15 chapters)
1
Section 1: Installing and Deploying Metabase
4
Section 2: Setting Up Your Instance and Asking Questions of Your Data
12
Section 3: Advanced Functionality and Paid Features

Using variables in SQL queries

In the last section, we learned how to connect filters to saved questions written in SQL. However, to do so, we needed to use the notebook editor as an intermediary step. It would not have worked had we written the question in pure SQL. Let's see for ourselves, by recreating the Count of Menu Items Ordered question in pure SQL:

  1. Open up the Items Ordered question we saved earlier.
  2. Click the diagonal arrows to expand the editor.
  3. Edit the SQL as follows:
SELECT 
    c.name 
    , SUM(item_count) as items_ordered 
FROM 
(
SELECT 
    * 
    , CAST(single_item_orders->>'id_menu' AS INT) as id_menu
    , CAST(single_item_orders->>'count' AS INT) as item_count
FROM 
    (
        SELECT 
        	*
&...