Querying Real Time Data

As you may recall, a developer now has access to the sales_event table. Login to your AWS account as the user lf-developer. Let see how can we query real-time data using Amazon Athena.
  1. From the AWS Management console, search for Amazon Athena service.
  2. Make sure you are logged in as a lf-developer.
  3. Please select the tpc database.
  4. Select the dl_tpc_sales_event table and see the columns that were added by the Glue Crawler.
  5. Run the following query:
    SELECT * FROM "tpc"."dl_tpc_sales_event" limit 10;
    This query is going to show a sample of the data that is inside the table
  6. Run the following query every 60 seconds and you will notice how the number of records increases:
    SELECT count(productname) FROM "tpc"."dl_tpc_sales_event";
    Time 1: Time 2:
  7. Now, let's try to query the same table with another user without access to the dl_tpc_sales_even table and see what happens. Login to your AWS account as the user lf-business-analyst (default password: Password1!).
  8. From the AWS Management console, search for Amazon Athena service.
  9. Make sure you are logged in as a lf-business-analyst user.
  10. Please select the tpc database.
  11. You can see the list of tables that the lf-business-analyst user has access, and dl_tpc_sales_even is not one of them.
  12. Run the following query:
    SELECT * FROM "tpc"."dl_tpc_sales_event" limit 10;
    This query is going to show a sample of the data that is inside the table.
  13. The last query tried to access the dl_tpc_sales_even table and as expected the business analyst user got an error message.
Congratulations!, you have finished this lab.