Strata Scratch Problem Sets

Problem sets, exercises, and educational guides for SQL and python. These exercises are specifically tailored for business and marketing analytics students and novices.

Back to the Strata Scratch website
Login to Strata Scratch

How to Install psycopg2 to Connect to Strata Scratch Using Python

You can install psycopg2 in your Jupyter notebook. You’ll only need to install psycopg2 once and after that, you merely need to import psycopg2.

  1. Open a new Jupyter notebook

  2. In the notebook type the command below:

import sys
!conda install --yes --prefix {sys.prefix} psycopg2

strata scratch

import sys
!conda install --yes --prefix "{sys.prefix}" psycopg2

strata scratch

  1. To test if the installation was successful, type the following command in your Jupyter notebook.
import psycopg2

strata scratch

There will be no output or error if the code has been successfully executed.

You are now ready to connect to the Strata Scratch database. Please refer to How to Connect to Your Database using Python and Other Programs to learn how to connect to our database.