Submission for Udacity's Full Stack Web Developer Nanodegree Program's Logs Analysis Project. The project tests SQL skills learnt in Section 3 of the nanodegree.
The program written in logs_analysis.py will query a News database to answer the following questions:
- What are the most popular three articles of all time?
- Who are the most popular article authors of all time?
- On which days did more than 1% of requests lead to errors?
Follow these steps to run the project. You must use a terminal (command line interface):
-
Install VirtualBox
You can download it from virtualbox.org, here. Install the platform package for your operating system.
-
Install Vagrant
Vagrant is the software that configures the VM and lets you share files between your host computer and the VM's filesystem. Download it from vagrantup.com. Install the version for your operating system.
-
Download the VM Configuration
Fork and clone the Fullstack Nanodegree VM Repo. Open up your terminal and then
cd
into the directory. Inside, you will find another directory called vagrant. Change directory to the vagrant directory. -
Start the virtual machine
From inside the vagrant directory run the following command:
vagrant up
After that is completed run the following command to login to the virtual machine:
vagrant ssh
-
Download the data
Next, download the data here. You will need to unzip this file after downloading it. The file inside is called newsdata.sql. Put this file into the vagrant directory, which is shared with your virtual machine. To load the data, go into the vagrant directory and enter the command:
psql -d news -f newsdata.sql
-
Download the code
Clone this repository to the vagrant directory. Go into the directory and then run:
python logs_analysis.py
This should print the results on the terminal.