Coder Social home page Coder Social logo

logs-analysis's Introduction

About

In this repository you will find my solution to the Logs Analysis project from Udacity's Full Stack Nanodegree. This project explores basic concepts regarding Python, Relational Databases, Queries and Views by analyzing a fictional news website database.

The questions that my queries answer

    1. What are the most popular three articles of all time?
    1. Who are the most popular article authors of all time?
    1. On which days did more than 1% of requests lead to errors?

Setup

How to get/install Python version 2 or 3

Download link: https://www.python.org/downloads/

How to get/install VirtualBox

Download link: https://www.virtualbox.org/wiki/Downloads

How to get/install and setup Vagrant

Step One - Download and install vagrant from https://www.vagrantup.com/downloads.html

Step Two - cd into the vagrant directory with your shell(windows - Git Bash, Linux/Mac OS- Terminal)

Step Three - run the command vagrant up with your shell in order to turn on the virtual machine and then run vagrant ssh in order to get into the virtual machine shell

How to get and set up the PostgreSQL API on your virtual machine

Follow the detailed instructions on PostgreSQL's website on the following link: https://www.postgresql.org/download/linux/ubuntu/

How to get and set up the news database

Step One - Download the database file from https://d17h27t6h515a5.cloudfront.net/topher/2016/August/57b5f748_newsdata/newsdata.zip

Step Two - Unzip the file and place newsdata.sql into the vagrant directory on your local machine

Step Three - cd into the vagrant directory with your shell(windows - Git Bash, Linux/Mac OS- Terminal) and run the command psql -d news -f newsdata.sql

Views used in the project

View for showing the articles that each author wrote(used in the second query):

  • CREATE VIEW article_authors as SELECT articles.slug ,authors.name FROM authors, articles WHERE articles.author =authors .id;

View for showing the amount of entries with errors for each date in the log table(used in the third query)

  • CREATE VIEW as failed_entries SELECT date(time),count(log.status) FROM log WHERE log.status NOT LIKE '%200%' group by date(time) ORDER BY date(time) DESC;

View for showing the amount of entries in total for each date in the log table(used in the third query)

  • CREATE VIEW all_entries as SELECT date(time),count(log.status) FROM log group by date(time) ORDER BY date(time) DESC;

Functions

first_query() - The solution for the first query in the project

second_query() - The solution for the second query in the project

third_query() - The solution for the third query in the project

logs-analysis's People

Contributors

naorpeled avatar

Stargazers

Ivan Solobear avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.