Udacity - Full Stack Web Developer Nanodegree
This project is to create a reporting tool that prints out reports (in plain text) based on the data in the database. This reporting tool is a Python program using the psycopg2 module to connect to the database.
Here are the questions the reporting tool should answer:
- 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?
$ git clone https://github.com/udacity/fullstack-nanodegree-vm
$ cd vagrant
$ vagrant up
$ vagrant ssh
Download database from here. Extract newsdata.sql file.
$ psql -d news -f newsdata.sql
$ psql -d news
news=> create view article_request as select title, slug, log.time from articles, log where log.path like CONCAT('/article/', articles.slug) and status = '200 OK';
news=> create view author_article as select authors.name, articles.slug from authors, articles where authors.id = articles.author order by authors.name;
news=> create view requests_per_day as select DATE(time) as date, count(*) from log group by date;
news=> create view errors_per_day as select DATE(time) as date, count(*) from log where status = '404 NOT FOUND' group by date;
$ python log.py