Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Superset

Superset can connect to many DB. Currently it connects to our Replica database. Following is the result if we open datasets There is a time when the table doesn’t have the required data, so here is what we can do:

  1. Join another table
  2. Create a virtual column
  3. Create a new table in Rails to collect the data (the last option if the first two options can not fulfill the requirements) You can do some experiments on this page https://superset-v2.hungryhub.com/superset/sqllab/ before creating any charts

Example charts

We also have many charts on the old superset https://superset.hungryhub.com/ that you can copy to the new superset

Difference between superset.hungryhub and superset-v2.hungryhub

superset.hungryhub.com uses Superset version 0.xxx but superset-v2.hungryhub.com uses Superset version 1.xxx You need to make some modification to create a similar chart of superset V0 to V1

How to create a correct reservation dataset

We have so many reservation features, that’s why there are many columns on the reservations table To create a correct report on Superset for reservation, you need to filter the table based on the following filters:

  1. active = 1
  2. ack = 1
  3. is_temporary = 0
  4. for_locking_system = 0
  5. adjusted = 0
  6. no_show = 0 You need to join it with table reservation_packages. If it doesn’t have a reference toreservation_packages table, the record is invalid. Maybe you need to add GROUP BY [reservations.id](<http://reservations.id>)

How to create a correct restaurant dataset

To create an accurate report on Superset for restaurants, you need to filter the restaurants table based on the following criteria:

  1. active column should be equal to 1 (active = 1 or active IS TRUE)
  2. The expiry_date column should be greater than or equal to today's date (expiry_date ≥ NOW()). By applying these filters, you will retrieve only the active restaurants that have not expired yet. This will help you to get the most up-to-date and accurate data for your report. It's important to make sure that you are only including active restaurants in your analysis, as it can skew your results if you include inactive ones. Additionally, filtering by the expiry_date column ensures that only currently valid restaurant data is displayed in your report.

How to add a dataset of restaurants who sell voucher

To retrieve restaurants that sell vouchers only from the restaurants table, you need to filter based on the following criteria:

  1. The voucher_offer_date column should be greater than or equal to today's date (voucher_offer_date ≥ NOW()). By applying these filters, you will retrieve only restaurants that are currently offering vouchers. This will help you to get the most up-to-date and accurate data for your report. Additionally, filtering by the voucher_offer_date column ensures that only currently valid restaurant data is displayed in your report. It's important to make sure that you are only including active restaurants in your analysis. To do that you need to combine the query conditions like this:
(active IS TRUE AND expiry_date >= NOW()) AND (voucher_offer_date >= NOW())

The query above will retrieve only active restaurants that sell vouchers only.