Redash v5 Quick Start Guide Create and share interactive dashboards using Redash Alexander Leibzon Yael Leibzon BIRMINGHAM - MUMBAI Redash v5 Quick Start Guide Copyright © 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Sunith Shetty Acquisition Editor: Siddharth Mandal Content Development Editor: Kirk Dsouza Technical Editor: Jinesh Topiwala Copy Editor: Safis Editing Project Coordinator: Hardik Bhinde Proofreader: Safis Editing Indexer: Rekha Nair Graphics: Jason Monteiro Production Coordinator: Shantanu Zagade First published: September 2018 Production reference: 1290918 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78899-616-7 www.packtpub.com mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content PacktPub.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Foreword It's amazing to realize that Redash started five years ago. It started as a hackathon project, which was open sourced two months later. I remember getting excited about the first 5 companies that started using Redash. Today, Redash is a company on its own, and there are over 4500 teams around the world using Redash, both the open source project and the SaaS service. Reading the first book on Redash is another important milestone in Redash’s maturity. Alexander and Yael are great candidates to write the book. Alexander contributed code to the project and is very familiar with its internals, while Yael used it in various data projects for multiple companies since the early days of Redash. I hope you will find this book useful, and it will help you start using Redash. You should also remember that Redash is an active open source project, which means it keeps evolving constantly. I suggest that you familiarize yourself with the knowledge base along with the active community. Happy querying! Arik Fraimovich, Redash Creator/Founder Contributors About the authors Alexander Leibzon is a software infrastructure consultant and backend software developer with over 15 years' experience in the software development industry. Alexander is a contributor to Redash and several other open source projects. Prior to becoming an independent consultant, Alexander was a data infrastructure engineer at EverythingMe, the company where Redash was initially developed during a hackathon. Alexander holds a BSc degree in physics and computer science. I would like to thank my wife Yael, and kids for their patience and support throughout the writing process of the book, Arik for creating Redash, Kirk for keeping me on track with the schedule, and Tal for very helpful reviews. Yael Leibzon is a data analyst with 8 years' experience in the industry. Yael has been an extensive user of Redash for over 3 years. Yael holds an MSc in biomedical engineering. During Yael's academic research , Yael developed finite element computational models, which were published in biomedical literature. I would like to thank my husband, Alexander, for giving me the opportunity to write this book with him and for his enormous support and never-ending motivation. I would like to thank my children for keeping me happy through tough deadlines. Finally, I'd like to thank the Packt publishing team and reviewers of this book. About the reviewer Arik Fraimovich created Redash as a hackathon project while working for EverythingMe in 2013. He founded the Redash company in 2015 to make sure Redash has a sustainable future. Arik is also a developer and entrepreneur, developing software professionally for over 15 years and has passion for solving real users' problems. Tal Maizels is a chief technology officer with extensive experience in the marketing and advertising industry. Tal has led projects and teams in start-ups for the last 10 years in the fields of EdTech, consumer networks, and finance. An IT professional with a BSc in computer science and mathematics from Bar-Ilan University, Tal has over 20 years' experience in software development, design, and management, and is skilled in mobile applications, Java, Software as a Service (SaaS), Continuous Integration, and Scrum. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Chapter 1: Introducing Redash 5 Data challenges experienced by companies on a daily basis 6 An example dashboard 7 Ideal tools for targeting challenges 10 Meeting Redash 12 What exactly is Redash? 12 Redash architecture 16 Summary 17 Chapter 2: Installing Redash 18 Sizing – choosing the right machine to do the job 19 Installation options and installation walkthrough 20 Installation options 20 AWS-predefined image 21 Launching an instance using Redash AMI 23 Launching an instance using Bitnami Redash AMI 24 Welcome to Redash setup page 27 GCE-Predefined image 30 Docker-based installation 34 Provisioning script installation 36 Explaining the setup.sh script 37 Troubleshooting 39 Configuration and setup 40 Email configuration 40 Using Google OAuth to log in to Redash 44 Redash environment settings 45 HTTPS (SSL) Setup 49 Permissions in Redash 49 Groups 49 Creating and editing groups 51 Creating users 53 Summary 54 Chapter 3: Creating and Visualizing your First Query 55 Creating and testing the Data Source 55 Alternative static Data Source definition 60 Creating your first query 61 Creating the visualization 66 Table of Contents Creating the dashboard 71 Summary 74 Chapter 4: Connecting to Data Sources 75 Supported Data Sources 75 Adding a new Redash Data Source 81 A detailed walk-through of the selected Data Sources 83 Connecting to PostgreSQL 84 Connecting to ElasticSearch 85 Connecting to MongoDB 86 Connecting to GoogleSpreadsheet 88 Connecting to Url 89 Connecting to Query Results (beta) 91 Connecting to Amazon Athena 93 Connecting to BigQuery 94 Connecting to Redshift 96 Connecting to DynamoDB 97 Summary 99 Chapter 5: Writing and Executing Queries 100 Query listing 101 Query editor overview 102 Query operations 105 Creating a query 105 Editing a query 109 Forking a query 109 Archiving a query 111 Scheduling a query 113 Query results and filters 116 Query results 116 Query filters 118 Parametrized queries 122 Parameter settings 124 Query snippets 126 Alerts 128 Alert statuses 129 Creating Alerts 130 Alert destinations 134 Summary 135 Chapter 6: Creating Visualizations 136 The benefits of visualizations 136 An overview of visualization types 138 Boxplot 138 Chart 139 Map (Choropleth map) 142 [ ii ] Table of Contents Cohort 143 Counter 143 Funnel 144 Map (Markers map) 144 Pivot table 145 Sankey 147 Sunburst sequence 148 Word cloud 149 Table 149 Visualizations in action 150 Creating and editing visualizations 151 Going over Redash visualizations 153 Boxplot 154 Chart 155 Map (Choropleth) 158 Cohort 160 Counter 161 Funnel 162 Map (Markers) 163 Pivot Table 164 Sankey 165 Sunburst sequence 165 Table 166 Word Cloud 168 Special actions on visualizations 168 Summary 170 Chapter 7: Dashboards and Practical Tips 171 Dashboard how-tos 171 Creating/editing dashboards 172 Dashboard query filters, hashtags, and favorite dashboards 173 Dashboard-level filters 173 Dashboard hashtags 173 Favorite Dashboards 175 Sharing dashboards 176 Dashboard guidelines 177 Tips and tricks 179 Summary 182 Chapter 8: Customizing Redash 183 Redash API 184 API authentication 184 API calls overview 186 API usage examples 190 Extending Redash code 191 Installing Redash for development 191 Installing a Docker-based developer environment 192 [ iii ]