ssharma (39) [Avatar] Offline
#1
Dear Author,

I cloned the git from https://github.com/practical-recommender-systems/appendix1 but could not find the SQL script to create and load movies table mentioned in Section A.3.1?

thanks,
Kim Falk (22) [Avatar] Offline
#2
First of all thank you for buying the MEAP!

The script you are referring to is not on Github, it is only present in the text.

But it is a good idea to add the SQL scripts as well. Until that happens here is the script:

To create the table:

CREATE TABLE movies
(id  NUMERIC,
 title char(150),
 imdbID NUMERIC,
 spanishTitle char(150),
 imdbPictureURL char(250),
 year NUMERIC,
 rtID char(150),
 rtAllCriticsRating NUMERIC,
 rtAllCriticsNumReviews NUMERIC,
 rtAllCriticsNumFresh NUMERIC,
 rtAllCriticsNumRotten NUMERIC,
 rtAllCriticsScore NUMERIC,
 rtTopCriticsRating NUMERIC,
 rtTopCriticsNumReviews NUMERIC,
 rtTopCriticsNumFresh NUMERIC,
 rtTopCriticsNumRotten NUMERIC,
 rtTopCriticsScore NUMERIC,
 rtAudienceRating NUMERIC,
 rtAudienceNumRatings NUMERIC,
 rtAudienceScore NUMERIC,
 rtPictureURL char(250))


And to import the data:

COPY movies FROM 'C:\\data\\hetrec2011\\importable_movies.dat' 
ENCODING 'LATIN1'; 


The script is assuming the dat file is present in the following folder: "c:\data\hetrec2011\" please let me know if you have problems making it work.
Saramic (2) [Avatar] Offline
#3
Also once you run this and move onto Chapter 2 where there is a discussion of running a migration, things error out. The reason is that the movies table exists from work in Chpater 2. I would suggest that the user is promoted to use migrations from the beginning of the appendix. My solution was to work out that in Django I can list the state of migrations with
python manage.py showmigrations
and then skip the move migration using fake
python manage.py migrate --fake


On the general topic of following along with the code, myself being a rails developer, I have found a number of hurdles to jump over. I may add them to a separate topic if you would like. Things like http://moviegeek.com being hardcoded in a number of places like the JS library and nowhere did it mention to either change it or set it in hosts file to point to localhost. I still have no sessionId and userId being populated, is this something in Django I have to turn on? I am sure there have been a few others, I may try to be more complete in these notes if this is something that helps with writing of the book
Kim Falk (22) [Avatar] Offline
#4
Thank you for reading my book!

The book is still a work in progress, and I keep changing code back and forth to match what I want to teach in the book. So some things are still work in progress, and not as smooth as it could be.

It sounds like a good idea to use migrations from the beginning of the appendix.

The userid and session ids will be populated in one of the next updates, I have been working on adding users to the database using the Django user model. But I am still discussing with the editor where to add it in the book.

Again it is a work in progress, so I will be very happy to hear about things that you think make the code more readable.
Kim Falk (22) [Avatar] Offline
#5
Hi,

Just wanted to let everybody know that we are working on updating the book to make the code better and easier to understand. Not everything mentioned here has yet been fixed, but it will be smilie