Skip to content

This is an informative tool from logs by sql database queries. Interacting with a live database both from the command line and from the python code. This project is a part of the Udacity's Full Stack Web Developer Nanodegree.

Notifications You must be signed in to change notification settings

Arshad561/Logs-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logs Analysis Project

This is an informative tool from logs by sql database queries. 
It Interacts with a live db from both command line and the python code.

Technologies used

PostgreSQL
inux-based virtual machine (VM) Vagrant

Project Requirements

Reporting tool should 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?

System setup and how to view this project

This project makes use of Udacity's Linux-based virtual machine (VM) configuration which includes all of the necessary software to run the application.

Step 1 (Download VirtualBox and install)

VirtualBox is the software that actually runs the virtual machine.
You can download it from here

Step 2 (Download Vagrant and install)

Vagrant is the software that configures the VM and lets you share files between host and the VM's filesystem.
You can downlaod it from here

Step 3 (Download the VM configuration)

you can use Github to fork and clone this repository.
Change your directory to this repository and do cd vagrant

Step 4 (Start the virtual machine)

From your terminal, inside the vagrant subdirectory, run the command vagrant up
This will cause Vagrant to download the Linux operating system and install it.
When vagrant up is finished running, you will get your shell prompt back.
At this point, you can run vagrant ssh to log in to your newly installed Linux VM!

Step 5 (Downloading Prerequisite data)

Download the data here
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.

Step 6 (Loading the data)

To load the data, cd into the vagrant directory and use the command psql -d news -f newsdata.sql

Here's what this command does:

psql — the PostgreSQL command line program
-d news — connect to the database named news which has been set up for you
-f newsdata.sql — run the SQL statements in the file newsdata.sql

Step 7 (Creating the views)

The required views are mentioned in create_views.sql
You need to just run this command psql -d news -f create_views.sql to create the views in database.

Once you have done all these steps, run this command python news.py to start the reporting tool. You will see the output in commandline

Summary:

vagrant up ---> to start up the VM.
vagrant ssh ---> to log into the VM.
cd /vagrant ---> to change to your vagrant directory.
psql -d news -f newsdata.sql ---> to load the data and create the tables.
psql -d news -f create_views.sql ---> to create the views which can be reusable.
python news.py ---> to run the reporting tool.
pycodestyle news.py ---> to check for code standards and warnings

The code is error free and conforms to the PEP8 style recommendations.<br>
The code presents its output in clearly formatted plain text.

About

This is an informative tool from logs by sql database queries. Interacting with a live database both from the command line and from the python code. This project is a part of the Udacity's Full Stack Web Developer Nanodegree.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages