Make Your Company Data Driven with Redash

Develop a data system that every business user wants to use.



Make Your Company Data Driven with RedashImage by Author | Ideogram

 

Data has become the most important commodity for business because it helps make decisions that enhance the company. With technological advancements, data collection and storage have also become easier, allowing businesses to accumulate vast amounts of data. However, what is essential today is how we utilize and present this data to gain insights rather than simply storing it.

To gain insight from data, we need a platform that can manage and present it in a way that businesses understand. Redash is one of the best projects for creating a data platform.

In this article, we will explore Redash and how you can leverage it to make your company data-driven.

 

Redash Implementation

 
Redash is an open source analytics platform designed for any technical level to leverage the power of data. The platform allows users to connect with data sources, visualize them, and share the interactive dashboard, all while maintaining control over the platform itself. Redash is also browser-based, so you can set it up without needing a complex ecosystem.

Let’s learn how to set up the Redash platform locally using Docker. The first thing you will need is Docker, so download and install Docker Desktop according to your system.

Next, open your favourite programming IDE and create a file called docker-compose.yml. Once the file exists, we will fill it with the following code.

version: '3.8'

services:
  redash:
    image: redash/redash:latest
    command: server
    depends_on:
      - redis
      - postgres
    ports:
      - "5000:5000"
    env_file:
      - .env
    restart: always

  scheduler:
    image: redash/redash:latest
    command: scheduler
    depends_on:
      - redis
      - postgres
    env_file:
      - .env
    restart: always

  worker:
    image: redash/redash:latest
    command: worker
    depends_on:
      - redis
      - postgres
    env_file:
      - .env
    restart: always

  redis:
    image: redis:latest
    restart: always

  postgres:
    image: postgres:latest
    environment:
      POSTGRES_PASSWORD: redash
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:

 

The Docker compose file above will set up our Redash platform using the following Docker container dependencies:

  • Three Redash service components (server, scheduler, worker)
  • A Redis service
  • A PostgreSQL service
  • One named volume for persistent database storage

These components allow Redash to work correctly and enable users to access the Redash platform effectively.

Next, create a file called .env and fill them with the following code.

REDASH_REDIS_URL=redis://redis:6379/0
REDASH_DATABASE_URL=postgresql://postgres:redash@postgres/postgres
REDASH_COOKIE_SECRET=your_shared_cookie_secret
REDASH_SECRET_KEY=your_shared_secret_key
QUEUES=queries,scheduled_queries,schemas
WORKERS_COUNT=2

 

The environment variables above control the necessary information for Redash. You can change them to your preferred settings, especially the cookie and secret key settings, which can be replaced with more secure options.

With all the files ready, we will start running the Redash platform.

First, we must run the database migration for the data storage to work properly.

docker compose run --rm server manage db upgrade

 

Then, we will start all the services using the following command.

docker compose up -d

 

If the Docker compose above runs well, we will move on to the next section, using the Redash platform for our work.

 

Using the Redash Platform

 
As Docker expose the port 5000, we could now access the Redash platform in the following URI:

http://localhost:5000

 

Use the URI above in your browser to see the following setup.

 
Make Your Company Data Driven with Redash
 

Fill it up with your information and secure your credentials somewhere to avoid forgetting about them.

After you have entered all the credential information, you will be shown the following screen.

 
Make Your Company Data Driven with Redash
 

From the welcome screen, we will connect to the PostgreSQL data source in the Docker container. To do that, select Connect to Data Source, and we will get the following data source selection as shown below.

 
Make Your Company Data Driven with Redash
 

Select PostgreSQL and fill in the necessary information regarding the database. Here are the directions to provide the required information:

Name: Any name (e.g., Local) 
Host: postgres (container name in docker-compose) 
Port: 5432 
User: postgres 
Password:redash 
SSL Mode: prefer (default) 
Database Name: postgres

 

You can change the information above as you like. Test the connection, and we will move to the query if the connection is successful.

In the Query tab, try to run the following code:

select now()

 

Select the execute button. The current time information will appear on your screen if the run is successful.

 
Make Your Company Data Driven with Redash
 

Let’s create a new table to simulate incoming data. Run the following query, and you will get a new table called Sales populated with sample data.

-- Create the 'sales' table
CREATE TABLE sales (
    id SERIAL PRIMARY KEY,
    region VARCHAR(50),
    product VARCHAR(50),
    quantity INT,
    revenue NUMERIC,
    sale_date DATE
);

-- Insert sample data
INSERT INTO sales (region, product, quantity, revenue, sale_date) VALUES
('North', 'Widget A', 10, 250.00, '2025-05-01'),
('South', 'Widget B', 5, 150.00, '2025-05-02'),
('East', 'Widget A', 7, 175.00, '2025-05-03'),
('West', 'Widget C', 3, 90.00, '2025-05-04'),
('North', 'Widget B', 8, 200.00, '2025-05-05');

 

Redash allows us to save all the frequently used queries, which will serve as the data that the Redash dashboard will reference. For this example, let’s create a Sales Query query with the following code.

select * from sales

 
Save the query, and let’s move on to the dashboard. Select to create the dashboard and name it Sales Dashboard. You will see the Redash dashboard, which looks similar to the image below.

 
Make Your Company Data Driven with Redash
 

Select to add a widget and choose the Sales Query; for now, you can only select the table visualization.

 
Make Your Company Data Driven with Redash
 

After you select the table, you can drag them around the dashboard.

 
Make Your Company Data Driven with Redash
 

It looks nice, but how do we add another visualization, such as a bar chart? In this case, we need to go back into the query and select the New Visualization button.

 
Make Your Company Data Driven with Redash
 

From there, you can select the types of visualisations you want to add to your dashboard. For example, the example below shows how we created a new bar chart regarding the Revenue per Region.

 
Make Your Company Data Driven with Redash
 

Save the chart visualization and let’s return to the sales dashboard once again. Select Add Widget again and choose the Sales Query. From the drop-down menu, there will be a new chart we just created previously. Select it and add the chart to the dashboard.

The overall dashboard will look like the image below.

 
Make Your Company Data Driven with Redash
 

It’s an interactive dashboard, so you can experiment with the visualization chart you just created.

Save the dashboard, and you can select whether to share it with the public. However, as we are only hosting the Redash dashboard on localhost, the link will not working anywhere but your local environment.

 
Make Your Company Data Driven with Redash
 

If you open the dashboard link, you will see a dashboard similar to the image below.

 
Make Your Company Data Driven with Redash
 

That’s all the basics of using Redash. Try to explore various data sources and visualization implementations necessary for your project. If you want to host Redash in your cloud, you can refer to the Redash setup.

 

Conclusion

 
Data has become hugely important for businesses to gain an advantage over their competitors. To gain better insights from data, you need an analytic platform that can present data in better and friendlier format and layout.

In this article, we have explored Redash as a platform that allows companies to be data-driven. We have learned how to implement Redash with Docker, connect with the data source, and use the data to create shareable, interactive dashboards.

I hope this has helped!
 
 

Cornellius Yudha Wijaya is a data science assistant manager and data writer. While working full-time at Allianz Indonesia, he loves to share Python and data tips via social media and writing media. Cornellius writes on a variety of AI and machine learning topics.


Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy


Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy

Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy

No, thanks!