This shows output from running both createDB.py and queryDB.py, and first describes the steps I took for where to build the DB file.

In my runs of queryDB.py I only have enabled the first 7 menu options (I commented out additional test option 8). You should leave these additional menu options in your submitted solution.

Setup

The first thing you want to do is create a subdirectory in /local with your user name into which you will create your movie.db file.

  • Here is an example command to create the directory (use your username and not the example user tnas):

    $ mkdir /local/tnas

    /local is a partition on the physical disk on each lab machine, thus the contents of /local are different on every machine.

    This is different from /home and /scratch that are the same on every machine becase they are NFS mounted file systems. This means that their data are stored on disks on a file server on the CS network and are fetched from over the network in response to your reading or writing files and directories in them (e.g. cd, ls, vim filename, mkdir, etc.). The df command lists all mounted file systems on a machine.

    It is usually faster to access files in /local than it is to access files in /home or /scrach. However, /local differs on every machine, so you will want to be careful to clean-up large files that you create on a specific machine’s /local.

    • Here is how to remove your movie.db file created from running createDB.py, which you should do after a session (don’t leave these files in /local on a bunch of lab machines:

      $ rm /local/tnas/movie.db

      You could also remove the directory (this is not as big a deal to leave as it is small):

      $ rmdir /local/tnas
  • Finally, you can keep working on the same lab machine (using its /local) by ssh’ing into it from another CS lab machine or from your laptop To ssh into a specific machine (example owl) from another cs lab machine:

    $ ssh owl

You can also move (use mv and not copy cp) your movie.db file from /local on one machine into /scratch at the end of a session, and then copy from /scratch to /local on the machine you log into next time you work. See Tips for Performance and Storage for more details.

Create Movie DB

Next, you will create your movie data base by completing the implementation and running createDB.py (remember to remove this after each session).

Here is an example use of runnin createDB.py where I am saving my result in /local/tnas/ that I already created (you are not required to use time, this is just to give you an idea of how long my run takes): to run):

$ cd cs44/labs/Lab4-me-partner/

$ time python3 ./createDB.py /local/tnas/movie.db
Creating new movie database!

...Creating Tables...
...Inserting Records...
...Building Indexes...

real	0m45.733s
user	0m34.871s
sys	0m9.061s

Run Queries on Movie DB

Once the movie.db is correctly created, you can then run queries on it.

Here are some example runs from my solution. Note the times as an estimate of times to aim for in your solution. I’ve removed the output of the query plan (since it infers some of my solution), and I’ve not included all the results from every query in this ouput.

$ python3 ./queryDB.py /local/tnas/movie.db
Welcome to the Movie Database!

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 1


24 results; Completed in 0.000 seconds

fname                lname
----------------------------------------
André the Giant
Anne                 Dyson
Betsy                Brantley
Billy                Crystal
Carol                Kane
Cary                 Elwes
Chris                Sarandon
Christopher          Guest
Derek                Pykett
Fred                 Savage
Garrett              Brawith
Lauren               Mora
Malcolm              Storry
Mandy                Patinkin
Margery              Mason
Mel                  Smith
Paul                 Badger
Peter                Cook
Peter                Falk
Regan                Burns
Rob                  Reiner
Robin                Wright Penn
Wallace              Shawn
Willoughby           Gray

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 2

Enter Actor's first name: Samantha
Enter Actor's last name: Goldstein

4 results; Completed in 0.000 seconds

title
--------------------
Anywhere But Here
Firetrap
Surfer Girl House
The Three Faces of Phoebe

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 3

Enter first actor's first name: James
Enter first actor's last name: Stewart
Enter second actor's first name: Katharine
Enter second actor's last name: Hepburn

12 results; Completed in 0.000 seconds

id                   title
----------------------------------------
86099                America at the Movies
150873               Fonda on Fonda
[more results]

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 2

Enter Actor's first name: Kevin
Enter Actor's last name: Bacon

[~215-230 results] Completed in 0.001 seconds

title
--------------------
'Hollow Man': Anatomy of a Thriller
[more results]

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 4


47 results; Completed in 0.117 seconds

fname                lname                FilmCount
------------------------------------------------------------
Ellen                Brown                2270
[more results]
Paul                 Miller               506

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 5


20 results; Completed in 0.115 seconds

fname                lname                NumFilms
------------------------------------------------------------
Kyra                 Sedgwick             18
Tom                  Hanks                14
[more results]

# NOTE: You will get Tom Hanks as your top result if you
# double-count movies with multiple roles (you should not)

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 6


24 results; Completed in 0.363 seconds

fname                lname                title                NumRoles
--------------------------------------------------------------------------------
Nicky                Figueredo            Is This a Joke?      8
Scott                Morales              Is This a Joke?      8
[more results]
Mark                 McKinney             The Stages of Grief  5

Query Plan:
-----------
[result redacted as it reveals my answer and indicies I built]

Menu of options:
(0) Exit
(1) Query 1: Cast of the Princess Bride
(2) Query 2: Actor Filmography
(3) Query 3: Co-stars
(4) Query 4: Prolific Directors
(5) Query 5: Bacon's Favorites
(6) Query 6: Versatile Actors
(7) Query 7: Programmer's Choice
Enter your choice: 0