This project created a basic CLI analytic program that examines data in a PostgreSQL database and prints out reports in plain-text format using python3. Over 2 million data was anaalysed based on log entries in the database.
This Program generated report on the following descriptive statistics:
- The most popular three articles of all time
- The most popular article authors of all time
- Days with more than 1% of error requests
- Python 3
- PostgreSQL
- newsdata.sql
- 'vagrant'
- 'VirtualBox'
- Installation set-up require Unix-Style Terminal or Git Bash Terminal for windows
- Download VirtualBox virtualbox.org
- Install Vagrant vagrantup.com
Note to make a firewall exception or allow permissions for these downloads
- Check for successful download with
vagrant --version
- Navigate into the 'vagrant' directory, run
vagrant up
. - SSH to the virtual machine with
vagrant ssh
.
- Navigate to the vagrant directory
cd /vagrant
- Use the command
psql -d news -f newsdata.sql
- Connect to your database using
psql -d news
- Explore the tables using the
\dt
and\d
table commands andselect
statements. - Exit the database with
\q
- Ensure the
newsSurvey.py
andnewsdata.sql
files are in the vagrant directory - Launch the VM:
a.
vagrant up
b.vagrant ssh
- Within the VM, navigate to
cd /vagrant
- Execute the file
newsSurvey.py
- If the execution fails then execute with
python3 newsSurvey.py
- The
NewsOutput.txt
is the output of the program