Getting ready

First make sure you have access to a PostgreSQL data instance.  Again, you can install one locally, run one in a container, or get an instance in the cloud.

As with MySQL, we need to first create a database. The process is almost identical to that of MySQL but with slightly different commands and parameters.

  1. From the terminal execute the psql command at the terminal.  This takes you into the psql command processor:
# psql -U postgrespsql (9.6.4)Type "help" for help.postgres=# 
  1. Now create the scraping database:
postgres=# create database scraping;CREATE DATABASEpostgres=#
  1. Then switch to the new database:
postgres=# \connect scrapingYou are now connected to database "scraping" as user "postgres".scraping=# 
  1. Now we can create ...

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.