Here's my entire code. Some parts I messed up the get and post methods, will work on that later on. Erm... how do I split the list without breaking up the review then? Or in the first place, is check_for_review a list of dictionaries? Cravan
On 4/7/19, 5:25 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: The corrupted value is in the "reviews" table. Are you populating that from a CSV file as well? If so, please show the code. As for fixing the other problem, I don't really understand what the code is trying to do, so I can't give you an exact solution. But let's have a look in more detail: check_for_review_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie') check_for_review = engine.execute(check_for_review_statement, movie=movie_title).fetchall() if res.status_code == 200: if len(check_for_review) != 0: check_for_review_splitted = str(check_for_review).split(',') So "check_for_review" is a list of rows. Each row is an SQLAlchemy RowProxy object that behaves a bit like a mix between a tuple and a dictionary. These objects are properly structured, so that you can access the rows and columns easily: row = check_for_review[0] rating = row["rating"] But you're calling "str(check_for_review)". That turns the nice structured set of objects into a single string, looking something like this: "[('Spider-Man', '10', 'peterp', 'Amazing, Incredible')]" Then you're turning that string back into a list by splitting it on commas. The individual items in that list will now be: "[('Spider-Man'" " '10'" " 'peterp'" " 'Amazing" " Incredible')]" As you can see, you've got unwanted brackets and quotes, and because the review itself contained a comma, you've split that up as well. Simon On Wed, Jul 3, 2019 at 3:48 PM Cravan <cravan...@gmail.com> wrote: > > How do you suggest I change it then? I import my values are from a csv sheet as per the task requirements. As for the other problem, how should I change it? And may I know why will it not work/break badly? > Cravan > > On 3/7/19, 10:43 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > Look more closely here: > > 2019-07-03 22:21:46,676 INFO sqlalchemy.engine.base.Engine SELECT * > FROM reviews WHERE movie = %(movie)s > 2019-07-03 22:21:46,676 INFO sqlalchemy.engine.base.Engine {'movie': > "('The Lego Movie'"} > 2019-07-03 22:21:47,375 DEBUG sqlalchemy.engine.base.Engine Col > ('movie', 'rating', 'username', 'review') > 2019-07-03 22:21:47,376 DEBUG sqlalchemy.engine.base.Engine Row > ("('The Lego Movie'", Decimal('1'), 'sms', ' > a very cool movie') > > The value in the "movie" column is literally: > > ('The Lego Movie' > > ie. "open parenthesis, single quote, The Lego Movie, single quote" > > Whatever you're doing to insert data into the database is broken. > > Things like this also raise red flags: > > check_for_review = engine.execute(check_for_review_statement, > movie=movie_title).fetchall() > check_for_review_splitted = str(check_for_review).split(',') > > You're getting a list of rows, converting them to a string, and then > splitting that string on commas. This will break badly in anything but > the simplest of cases. > > Simon > > On Wed, Jul 3, 2019 at 3:23 PM Cravan <cravan...@gmail.com> wrote: > > > > Yes, it is. > > ```` > > 2019-07-03 22:21:43,914 INFO sqlalchemy.engine.base.Engine select version() > > 2019-07-03 22:21:43,915 INFO sqlalchemy.engine.base.Engine {} > > 2019-07-03 22:21:44,608 DEBUG sqlalchemy.engine.base.Engine Col ('version',) > > 2019-07-03 22:21:44,608 DEBUG sqlalchemy.engine.base.Engine Row ('PostgreSQL 11.4 (Ubuntu 11.4-1.pgdg16.04+1 > > ) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit',) > > 2019-07-03 22:21:44,609 INFO sqlalchemy.engine.base.Engine select current_schema() > > 2019-07-03 22:21:44,610 INFO sqlalchemy.engine.base.Engine {} > > 2019-07-03 22:21:45,020 DEBUG sqlalchemy.engine.base.Engine Col ('current_schema',) > > 2019-07-03 22:21:45,021 DEBUG sqlalchemy.engine.base.Engine Row ('public',) > > 2019-07-03 22:21:45,346 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) > > AS anon_1 > > 2019-07-03 22:21:45,346 INFO sqlalchemy.engine.base.Engine {} > > 2019-07-03 22:21:45,670 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60) > > ) AS anon_1 > > 2019-07-03 22:21:45,671 INFO sqlalchemy.engine.base.Engine {} > > 2019-07-03 22:21:46,000 INFO sqlalchemy.engine.base.Engine show standard_conforming_strings > > 2019-07-03 22:21:46,000 INFO sqlalchemy.engine.base.Engine {} > > 2019-07-03 22:21:46,348 DEBUG sqlalchemy.engine.base.Engine Col ('standard_conforming_strings',) > > 2019-07-03 22:21:46,348 DEBUG sqlalchemy.engine.base.Engine Row ('on',) > > 2019-07-03 22:21:46,676 INFO sqlalchemy.engine.base.Engine SELECT * FROM reviews WHERE movie = %(movie)s > > 2019-07-03 22:21:46,676 INFO sqlalchemy.engine.base.Engine {'movie': "('The Lego Movie'"} > > 2019-07-03 22:21:47,375 DEBUG sqlalchemy.engine.base.Engine Col ('movie', 'rating', 'username', 'review') > > 2019-07-03 22:21:47,376 DEBUG sqlalchemy.engine.base.Engine Row ("('The Lego Movie'", Decimal('1'), 'sms', ' > > a very cool movie') > > 127.0.0.1 - - [03/Jul/2019 22:21:47] "GET /movies/%28%27The%20Lego%20Movie%27%2C%202014%2C%20100%2C%20%27tt1 > > 490017%27%2C%20Decimal%28%277.8%27%29%29 HTTP/1.1" 200 - > > ```` > > Cravan > > On 3/7/19, 10:20 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > > > Is that screenshot from a review for The Lego Movie? Can you show the > > log output when you generate that page? > > > > On Wed, Jul 3, 2019 at 3:16 PM Cravan <cravan...@gmail.com> wrote: > > > > > > This is because I have a movie function that throws up any reviews; here it is: > > > ```` > > > @app.route("/movies/<movie>") > > > def movie(movie): > > > lol = movie.split(',') > > > movie_title = lol[0] > > > res = requests.get("http://www.omdbapi.com/", params={"apikey": "c2c76d64", "t": movie_title, "plot": "full"}) > > > omdb_data = res.json() > > > ratings_list = omdb_data['Ratings'] > > > check_for_review_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie') > > > check_for_review = engine.execute(check_for_review_statement, movie=movie_title).fetchall() > > > if res.status_code == 200: > > > if len(check_for_review) != 0: > > > check_for_review_splitted = str(check_for_review).split(',') > > > return render_template("movie_individual.html", movie=lol, check_for_review=check_for_review_splitted, omdb_data=omdb_data, ratings_list=ratings_list) > > > else: > > > return render_template("movie_no_review.html", movie=lol, omdb_data=omdb_data, ratings_list=ratings_list) > > > else: > > > if len(check_for_review) != 0: > > > check_for_review_splitted = str(check_for_review).split(',') > > > return render_template("movie_noomdbdata.html", movie=lol, check_for_review=check_for_review_splitted) > > > else: > > > return render_template("movie_gotnothing.html", movie=lol, res=res.json()) > > > ```` > > > And it prints out the review.Here's a pic attached to this email. > > > Cravan > > > > > > > > > On 3/7/19, 10:13 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > > > > > On Wed, Jul 3, 2019 at 11:54 AM Cravan <cravan...@gmail.com> wrote: > > > > > > > > Hi Simon, > > > > I always turn on debug mode using export FLASK_DEBUG=1 in the shell, but no error pops out, so I have no idea whether that is similar. I tried echo="debug", but didn’t really understand the results, so I am confused as to how to edit my code. I have used both edits as suggested, and this is what was produced: > > > > ```` > > > > 2019-07-03 18:49:43,100 INFO sqlalchemy.engine.base.Engine select version() > > > > 2019-07-03 18:49:43,100 INFO sqlalchemy.engine.base.Engine {} > > > > 2019-07-03 18:49:43,764 DEBUG sqlalchemy.engine.base.Engine Col ('version',) > > > > 2019-07-03 18:49:43,764 DEBUG sqlalchemy.engine.base.Engine Row ('PostgreSQL 11.4 (Ubuntu 11.4-1.pgdg16.04+1 > > > > ) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit',) > > > > 2019-07-03 18:49:43,765 INFO sqlalchemy.engine.base.Engine select current_schema() > > > > 2019-07-03 18:49:43,765 INFO sqlalchemy.engine.base.Engine {} > > > > 2019-07-03 18:49:44,109 DEBUG sqlalchemy.engine.base.Engine Col ('current_schema',) > > > > 2019-07-03 18:49:44,110 DEBUG sqlalchemy.engine.base.Engine Row ('public',) > > > > 2019-07-03 18:49:44,534 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) > > > > AS anon_1 > > > > 2019-07-03 18:49:44,534 INFO sqlalchemy.engine.base.Engine {} > > > > 2019-07-03 18:49:44,947 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60) > > > > ) AS anon_1 > > > > 2019-07-03 18:49:44,947 INFO sqlalchemy.engine.base.Engine {} > > > > 2019-07-03 18:49:45,353 INFO sqlalchemy.engine.base.Engine show standard_conforming_strings > > > > 2019-07-03 18:49:45,353 INFO sqlalchemy.engine.base.Engine {} > > > > 2019-07-03 18:49:45,762 DEBUG sqlalchemy.engine.base.Engine Col ('standard_conforming_strings',) > > > > 2019-07-03 18:49:45,762 DEBUG sqlalchemy.engine.base.Engine Row ('on',) > > > > > > Everything above this point is routine stuff that SQLAlchemy does to > > > figure out what verison of Postgresql it's talking to and what options > > > it is running with. You can safely ignore it. > > > > > > The next line is the first query that you've run: > > > > 2019-07-03 18:49:46,173 INFO sqlalchemy.engine.base.Engine SELECT title, year, "imdbRating" FROM movies WHER > > > > E "imdbID" = %(imdb_id)s > > > > > > These are the parameters that you passed to the query (in this case, > > > just the imdb_id): > > > > 2019-07-03 18:49:46,173 INFO sqlalchemy.engine.base.Engine {'imdb_id': 'tt1490017'} > > > > > > The "Col" line tells you the names of the columns in the result set: > > > > 2019-07-03 18:49:46,991 DEBUG sqlalchemy.engine.base.Engine Col ('title', 'year', 'imdbRating') > > > > > > ...and then you will normally see a "Row" line for each row in the > > > result. In this case your query returned a single row. The elements of > > > the row tuple correspond to the columns from the Col line. > > > > 2019-07-03 18:49:46,991 DEBUG sqlalchemy.engine.base.Engine Row ('The Lego Movie', 2014, Decimal('7.8')) > > > > > > I assume this is from your "print(check_for_api)" statement: > > > > ('The Lego Movie', 2014, Decimal('7.8')) > > > > > > Here's your next query: > > > > 2019-07-03 18:49:47,862 INFO sqlalchemy.engine.base.Engine SELECT * FROM reviews WHERE movie = %(movie_title > > > > )s > > > > > > ...and the parameters for that query: > > > > 2019-07-03 18:49:47,863 INFO sqlalchemy.engine.base.Engine {'movie_title': 'The Lego Movie'} > > > > > > The column names in the result set: > > > > 2019-07-03 18:49:48,699 DEBUG sqlalchemy.engine.base.Engine Col ('movie', 'rating', 'username', 'review') > > > > > > ...but then there are no Row lines, so the query didn't return any > > > rows. In other words, there are no rows in the "reviews" table where > > > the "movie" column equals "The Lego Movie". > > > > > > You said that you've confirmed that you've entered the review. How > > > have you confirmed that? > > > > > > Simon > > > > > > > > > > [] > > > > {"title": "The Lego Movie", "year": 2014, "imdb_id": "tt1490017", "director": "Phil Lord, Christopher Miller > > > > ", "actors": "Will Arnett, Elizabeth Banks, Craig Berry, Alison Brie", "imdb_rating": 7.8, "review_count": 0 > > > > , "average_score": "N.A"} > > > > 127.0.0.1 - - [03/Jul/2019 18:49:49] "GET /api/tt1490017 HTTP/1.1" 200 - > > > > ```` > > > > Also, I used three print statements, > > > > ```` > > > > print(check_for_api) > > > > ......#some code(same as before) > > > > print(check_for_reviews_unsplitted) > > > > ......#some code again(same as before) > > > > print (apijson) > > > > ```` > > > > Thanks, > > > > Cravan > > > > > > > > > > > > On 3/7/19, 12:07 AM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > > > > > > > You might want to try turning on debug logging for your SQL statements > > > > by passing echo="debug" when creating your engine: > > > > > > > > https://docs.sqlalchemy.org/en/13/core/engines.html#sqlalchemy.create_engine > > > > > > > > Amongst other things, this will show the values of parameters that you > > > > are passing to the database. > > > > > > > > I'm not sure what your problem is, but I notice that you are using > > > > "SELECT * FROM movies" to load your rows, and then you are assuming > > > > that the columns you get back are in a certain order. (You assume that > > > > the first column is title, the second is year, and the fifth is > > > > imdbrating). It's possible that the columns are coming back in a > > > > different order, and so the value you think is the title is actually > > > > something else. > > > > > > > > It would be better to explicitly list the columns you want, something like: > > > > > > > > SELECT title, year, imdbrating > > > > FROM movies > > > > WHERE "imdbID" = :imdb_id > > > > > > > > Alternatively, the rows that you get back from fetchall() actually > > > > know which columns they came from, so you could do this: > > > > > > > > # don't call list() here: > > > > check_for_api = check_for_api_unsplitted[0] > > > > > > > > # use dictionary-style access to get the individual values > > > > title = check_for_api["title"] > > > > > > > > Simon > > > > > > > > On Tue, Jul 2, 2019 at 3:33 PM Cravan <cravan...@gmail.com> wrote: > > > > > > > > > > Hi all, > > > > > > > > > > One of the other tasks for my movie review assignment is that I have to create api access to my website, which should return a json response including a review count. However, I have confirmed that I have entered a review for a specific movie and it prompts out in my html, but apparently when I try to print out the json I get 0 reviews for my review count. Can someone help me troubleshoot? Sorry if it sounds unclear. > > > > > > > > > > ```` > > > > > > > > > > @app.route("/api/<imdb_id>") > > > > > > > > > > def api(imdb_id): > > > > > > > > > > check_for_api_statement = sqlalchemy.text('SELECT * FROM movies WHERE "imdbID" = :imdb_id') > > > > > > > > > > check_for_api_unsplitted = engine.execute(check_for_api_statement, imdb_id=imdb_id).fetchall() > > > > > > > > > > res = requests.get("http://www.omdbapi.com/", params={"apikey": "c2c76d64", "i": imdb_id, "plot": "full"}) > > > > > > > > > > omdb_data = res.json() > > > > > > > > > > check_for_api = list(check_for_api_unsplitted[0]) > > > > > > > > > > title_unsplitted = check_for_api[0] > > > > > > > > > > title = check_for_api[0] > > > > > > > > > > year = check_for_api[1] > > > > > > > > > > imdb_id = imdb_id > > > > > > > > > > imdbrating = check_for_api[4] > > > > > > > > > > director = omdb_data['Director'] > > > > > > > > > > actors = omdb_data['Actors'] > > > > > > > > > > check_for_reviews_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie_title') > > > > > > > > > > check_for_reviews_unsplitted = engine.execute(check_for_reviews_statement, movie_title=title).fetchall() > > > > > > > > > > review_count = len(check_for_reviews_unsplitted) > > > > > > > > > > print(check_for_reviews_unsplitted) #this returns a blank list for some strange reason > > > > > > > > > > if len(check_for_reviews_unsplitted) != 0: > > > > > > > > > > check_for_reviews = check_for_reviews_unsplitted.split(',') > > > > > > > > > > score = float(check_for_reviews[4]) > > > > > > > > > > average_score = score/review_count > > > > > > > > > > else: > > > > > > > > > > average_score = "N.A" > > > > > > > > > > a = > > > > > > > > > > {"title":title,"year":year,"imdb_id":imdb_id,"director":director,"actors":actors,"imdb_rating":imdbrating,"review_count":review_count,"average_score":average_score} > > > > > > > > > > apijson = json.dumps(a, cls=CustomJsonEncoder) > > > > > > > > > > print (apijson) > > > > > > > > > > if len(check_for_api) != 0: > > > > > > > > > > return render_template("api.html", apijson=apijson) > > > > > > > > > > else: > > > > > > > > > > return render_template("error2.html", message="No such movie.") > > > > > > > > > > -- > > > > > SQLAlchemy - > > > > > The Python SQL Toolkit and Object Relational Mapper > > > > > > > > > > http://www.sqlalchemy.org/ > > > > > > > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > > > > --- > > > > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > > > > To post to this group, send email to sqlalchemy@googlegroups.com. > > > > > Visit this group at https://groups.google.com/group/sqlalchemy. > > > > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/7DB000C8-1EBC-48AF-A24F-202196C743CF%40gmail.com. > > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > -- > > > > SQLAlchemy - > > > > The Python SQL Toolkit and Object Relational Mapper > > > > > > > > http://www.sqlalchemy.org/ > > > > > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > > > --- > > > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > > > To post to this group, send email to sqlalchemy@googlegroups.com. > > > > Visit this group at https://groups.google.com/group/sqlalchemy. > > > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexfVMZTVX6hKDvxgRFG0Wrc%3DhSfwU05XQGm%2B7gsRTtR_Cw%40mail.gmail.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > > > > > > > > > -- > > > > SQLAlchemy - > > > > The Python SQL Toolkit and Object Relational Mapper > > > > > > > > http://www.sqlalchemy.org/ > > > > > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > > > --- > > > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > > > To post to this group, send email to sqlalchemy@googlegroups.com. > > > > Visit this group at https://groups.google.com/group/sqlalchemy. > > > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/FD18A0DF-70BD-4867-BA8C-A90DD76E24A3%40gmail.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > > SQLAlchemy - > > > The Python SQL Toolkit and Object Relational Mapper > > > > > > http://www.sqlalchemy.org/ > > > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > > --- > > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > > To post to this group, send email to sqlalchemy@googlegroups.com. > > > Visit this group at https://groups.google.com/group/sqlalchemy. > > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexc6%2BT%2BzNK%3DR2WPefSgGVkYnC8CyjGkF_ydN3HEFp_ggmg%40mail.gmail.com. > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > > -- > > > SQLAlchemy - > > > The Python SQL Toolkit and Object Relational Mapper > > > > > > http://www.sqlalchemy.org/ > > > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > > --- > > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > > To post to this group, send email to sqlalchemy@googlegroups.com. > > > Visit this group at https://groups.google.com/group/sqlalchemy. > > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/B6DBDE22-5A75-4DE6-B69C-346E5E597F9E%40gmail.com. > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > --- > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > To post to this group, send email to sqlalchemy@googlegroups.com. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexcoCcw1ggw3jcEiVomApD19BaLVKcVsNLU8DSOFa0%2BEzA%40mail.gmail.com. > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > > --- > > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > > To post to this group, send email to sqlalchemy@googlegroups.com. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/2F82992D-69A9-496E-A09D-881F3112EA83%40gmail.com. > > For more options, visit https://groups.google.com/d/optout. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > --- > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexe2LYymfKO%3DZS1uEFp_0ozJnscghjvfskWw7soah5gq1Q%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. > > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. > --- > You received this message because you are subscribed to the Google Groups "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/C2E9AF04-9E54-4A08-871D-60B8AE4491C4%40gmail.com. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexe2BNUfjX%3D8e-jhxejMD2V%2BT_QmOtr%3DS9tpQ1wD4Y0XJA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/D0B45315-194F-4CD3-A865-2554185085E8%40gmail.com. For more options, visit https://groups.google.com/d/optout.
import csv import sys import os import sqlalchemy from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy import create_engine from flask import Flask, render_template, request, session from flask_sqlalchemy import SQLAlchemy from flask_session import Session engine = create_engine(os.getenv("DATABASE_URL")) # database engine object from SQLAlchemy that manages connections to the database,# DATABASE_URL is an environment variable that indicates where the database lives def main(): f = open("movies.csv","r") reader = csv.reader(f, delimiter=';') for i, row in enumerate(reader): # loop gives each column a name if i == 0: continue if not row: continue print(i,row) title = row[0] year = int(row[1]) runtime = int(row[2]) imdbID = row[3] imdbRating = row[4] insert_statement = sqlalchemy.text('INSERT INTO movies(title, year, runtime, "imdbID", "imdbRating") VALUES (:title, :year, :runtime, :imdbID, :imdbRating)') engine.execute(insert_statement, title=title, year=year, runtime=runtime, imdbID=imdbID, imdbRating=imdbRating) if __name__ == "__main__": main()
import os import sqlalchemy import requests import json import decimal from flask import Flask, render_template, request, session, redirect, url_for, escape from flask_session import Session from sqlalchemy import create_engine engine = create_engine(os.getenv("DATABASE_URL"), echo="debug") app = Flask(__name__) app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' class CustomJsonEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, decimal.Decimal): return float(obj) return super(CustomJsonEncoder, self).default(obj) @app.route("/") def index(): return render_template("index.html") @app.route("/signup", methods=["POST"]) def signup(): username = request.form.get("username") password = request.form.get("psw") check_statement = sqlalchemy.text('SELECT * FROM users WHERE username = :name' ) user = engine.execute(check_statement,name=username, password=password ).fetchone() if user is not None: return render_template("index.html", message="(User already exists)") if user is None: insert_statement = sqlalchemy.text('INSERT INTO users(username, password) VALUES (:name, :password)') engine.execute(insert_statement, name=username, password=password) session['name'] = username return redirect(url_for('movies')) @app.route("/login", methods=["POST"]) def login(): name = request.form.get("login_name") password = request.form.get("pass") select_statement = sqlalchemy.text('SELECT * FROM users WHERE username = :name AND password = :password') user = engine.execute(select_statement, name=name, password=password).fetchone() if user is not None: session['name'] = name return redirect(url_for('movies')) elif user is None: return render_template("error.html", message="No such user.Please register your username before logging in, or check your password if you already have done so!") @app.route("/movies") def movies(): """Lists all movies.""" movies = engine.execute("SELECT * FROM movies").fetchall() return render_template("movies.html", movies=movies) @app.route("/search") def search(): return render_template("search.html") @app.route("/movie_results") def movie_results(): name = request.args.get("movie.title") year = request.args.get("movie.year") imdbid_not_splitted = request.args.get("movie.imdbid") imdbid = imdbid_not_splitted.strip() name_pattern = "%" + name + "%" if not year and not imdbid: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE title ILIKE :movie_title') movie_specific = engine.execute(search_movie_statement, movie_title=name_pattern).fetchall() elif not name and not imdbid: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE year = :year') movie_specific = engine.execute(search_movie_statement, year=year).fetchall() elif not name and not year: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE "imdbID" = :imdbId') movie_specific = engine.execute(search_movie_statement, imdbId=imdbid).fetchall() elif not name: print(name) search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE "imdbID" = :imdbid AND year = :year') movie_specific = engine.execute(search_movie_statement, imdbid=imdbid, year=year).fetchall() elif not year: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE "imdbID" = :imdbid and title ILIKE :movie_title') movie_specific = engine.execute(search_movie_statement, imdbid=imdbid, movie_title=name_pattern).fetchall() elif not imdbid: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE year = :year and title ILIKE :movie_title') movie_specific = engine.execute(search_movie_statement, year=year, movie_title=name_pattern).fetchall() elif name and year and imdbid: search_movie_statement = sqlalchemy.text('SELECT * FROM movies WHERE year = :year and title ILIKE :movie_title and imdbID = :imdbid') movie_specific = engine.execute(search_movie_statement, year=year, movie_title=name_pattern, imdbid=imdbid).fetchall() else: return render_template("error2.html", message="No movie input.") if len(movie_specific) != 0 and movie_specific is not None: return render_template("movie_specific.html", movie_specific=movie_specific) if len(movie_specific) == 0: return render_template("error2.html", message="No such movie.") @app.route("/logout") def logout(): session.pop('name', None) return redirect(url_for('index')) @app.route("/review/<movie>") def review(movie): movie_title = movie rating = request.args.get("myRating") review_name = request.args.get("review") username = session['name'] check_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie_title AND username = :name') check_no_other_review = engine.execute(check_statement, movie_title=movie_title, name=username).fetchall() if len(check_no_other_review) == 0 or check_no_other_review == None: insert_statement = sqlalchemy.text('INSERT INTO reviews(movie, rating, username, review) VALUES (:title, :rating, :name, :review)') engine.execute(insert_statement, title=movie_title, rating=rating, name=username, review=review_name) return redirect(url_for('movies')) if len(check_no_other_review) != 0: return render_template("error3.html", message="You already gave a review for this movie. Lol if you're so free go watch another movie!") @app.route("/movies/<movie>") def movie(movie): lol = movie.split(',') movie_title = lol[0] res = requests.get("http://www.omdbapi.com/", params={"apikey": "c2c76d64", "t": movie_title, "plot": "full"}) omdb_data = res.json() ratings_list = omdb_data['Ratings'] check_for_review_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie') check_for_review = engine.execute(check_for_review_statement, movie=movie_title).fetchall() if res.status_code == 200: if len(check_for_review) != 0: check_for_review_splitted = str(check_for_review).split(',') return render_template("movie_individual.html", movie=lol, check_for_review=check_for_review_splitted, omdb_data=omdb_data, ratings_list=ratings_list) else: return render_template("movie_no_review.html", movie=lol, omdb_data=omdb_data, ratings_list=ratings_list) else: if len(check_for_review) != 0: check_for_review_splitted = str(check_for_review).split(',') return render_template("movie_noomdbdata.html", movie=lol, check_for_review=check_for_review_splitted) else: return render_template("movie_gotnothing.html", movie=lol, res=res.json()) @app.route("/api/<imdb_id>") def api(imdb_id): check_for_api_statement = sqlalchemy.text('SELECT title, year, "imdbRating" FROM movies WHERE "imdbID" = :imdb_id') check_for_api_unsplitted = engine.execute(check_for_api_statement, imdb_id=imdb_id).fetchall() res = requests.get("http://www.omdbapi.com/", params={"apikey": "c2c76d64", "i": imdb_id, "plot": "full"}) omdb_data = res.json() check_for_api = check_for_api_unsplitted[0] print(check_for_api) title_unsplitted = check_for_api[0] title = check_for_api["title"] year = check_for_api[1] imdb_id = imdb_id imdbrating = check_for_api[2] director = omdb_data['Director'] actors = omdb_data['Actors'] check_for_reviews_statement = sqlalchemy.text('SELECT * FROM reviews WHERE movie = :movie_title') check_for_reviews_unsplitted = engine.execute(check_for_reviews_statement, movie_title=title).fetchall() review_count = len(check_for_reviews_unsplitted) print(check_for_reviews_unsplitted) if len(check_for_reviews_unsplitted) != 0: check_for_reviews = check_for_reviews_unsplitted.split(',') score = float(check_for_reviews[4]) average_score = score/review_count else: average_score = "N.A" a = {"title":title,"year":year,"imdb_id":imdb_id,"director":director,"actors":actors,"imdb_rating":imdbrating,"review_count":review_count,"average_score":average_score} apijson = json.dumps(a, cls=CustomJsonEncoder) print (apijson) if len(check_for_api) != 0: return render_template("api.html", apijson=apijson) else: return render_template("error2.html", message="No such movie.") if __name__ == "__main__": app.run()
Title;Year;Runtime;imdbID;imdbRating The Lego Movie;2014;100;tt1490017;7.8 The Shawshank Redemption;1994;142;tt0111161;9.3 The Godfather;1972;175;tt0068646;9.2 The Godfather: Part II;1974;202;tt0071562;9 The Dark Knight;2008;152;tt0468569;9 12 Angry Men;1957;96;tt0050083;8.9 Schindler's List;1993;195;tt0108052;8.9 The Lord of the Rings: The Return of the King;2003;201;tt0167260;8.9 Pulp Fiction;1994;154;tt0110912;8.9 The Good the Bad and the Ugly;1966;178;tt0060196;8.9 Fight Club;1999;139;tt0137523;8.8 The Lord of the Rings: The Fellowship of the Ring;2001;178;tt0120737;8.8 Forrest Gump;1994;142;tt0109830;8.8 Star Wars: Episode V - The Empire Strikes Back;1980;124;tt0080684;8.7 Inception;2010;148;tt1375666;8.8 The Lord of the Rings: The Two Towers;2002;179;tt0167261;8.7 Avengers: Endgame;2019;181;tt4154796;8.9 One Flew Over the Cuckoo's Nest;1975;133;tt0073486;8.7 Goodfellas;1990;146;tt0099685;8.7 The Matrix;1999;136;tt0133093;8.7 Seven Samurai;1954;207;tt0047478;8.7 Se7en;1995;127;tt0114369;8.6 City of God;2002;130;tt0317248;8.6 Star Wars: Episode IV - A New Hope;1977;121;tt0076759;8.6 The Silence of the Lambs;1991;118;tt0102926;8.6 It's a Wonderful Life;1946;130;tt0038650;8.6 Life Is Beautiful;1997;116;tt0118799;8.6 Spirited Away;2001;125;tt0245429;8.6 Saving Private Ryan;1998;169;tt0120815;8.6 The Usual Suspects;1995;106;tt0114814;8.6 Leon: The Professional;1994;110;tt0110413;8.6 The Green Mile;1999;189;tt0120689;8.6 Interstellar;2014;169;tt0816692;8.6 Psycho;1960;109;tt0054215;8.5 American History X;1998;119;tt0120586;8.5 City Lights;1931;87;tt0021749;8.5 Casablanca;1942;102;tt0034583;8.5 Once Upon a Time in the West;1968;165;tt0064116;8.5 The Pianist;2002;150;tt0253474;8.5 Modern Times;1936;87;tt0027977;8.5 The Intouchables;2011;112;tt1675434;8.5 The Departed;2006;151;tt0407887;8.5 Back to the Future;1985;116;tt0088763;8.5 Terminator 2: Judgment Day;1991;137;tt0103064;8.5 Whiplash;2014;106;tt2582802;8.5 The Lion King;1994;88;tt0110357;8.5 Rear Window;1954;112;tt0047396;8.5 Gladiator;2000;155;tt0172495;8.5 Raiders of the Lost Ark;1981;115;tt0082971;8.5 The Prestige;2006;130;tt0482571;8.5 Apocalypse Now;1979;147;tt0078788;8.5 Memento;2000;113;tt0209144;8.5 Alien;1979;117;tt0078748;8.5 Grave of the Fireflies;1988;89;tt0095327;8.5 Cinema Paradiso;1988;155;tt0095765;8.5 Spider-Man: Into the Spider-Verse;2018;117;tt4633694;8.5 The Great Dictator;1940;125;tt0032553;8.5 Sunset Boulevard;1950;110;tt0043014;8.4 The Lives of Others;2006;137;tt0405094;8.4 Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb;1964;95;tt0057012;8.4 Avengers: Infinity War;2018;149;tt4154756;8.5 Paths of Glory;1957;88;tt0050825;8.4 Django Unchained;2012;165;tt1853728;8.4 The Shining;1980;146;tt0081505;8.4 WALL-E;2008;98;tt0910970;8.4 Princess Mononoke;1997;134;tt0119698;8.4 Witness for the Prosecution;1957;116;tt0051201;8.4 Oldboy;2003;120;tt0364569;8.4 Aliens;1986;137;tt0090605;8.4 The Dark Knight Rises;2012;164;tt1345836;8.4 American Beauty;1999;122;tt0169547;8.4 Once Upon a Time in America;1984;229;tt0087843;8.4 Coco;2017;105;tt2380307;8.4 Das Boot;1981;149;tt0082096;8.4 Citizen Kane;1941;119;tt0033467;8.3 Braveheart;1995;178;tt0112573;8.4 Vertigo;1958;128;tt0052357;8.3 North by Northwest;1959;136;tt0053125;8.3 Reservoir Dogs;1992;99;tt0105236;8.3 Your Name;2015;22;tt6033368;8.9 Star Wars: Episode VI - Return of the Jedi;1983;131;tt0086190;8.3 M;1931;99;tt0022100;8.3 Amadeus;1984;160;tt0086879;8.3 Requiem for a Dream;2000;102;tt0180093;8.3 Dangal;2016;161;tt5074352;8.5 3 Idiots;2009;170;tt1187043;8.4 2001: A Space Odyssey;1968;149;tt0062622;8.3 Toy Story;1995;81;tt0114709;8.3 Like Stars on Earth;2007;165;tt0986264;8.4 Eternal Sunshine of the Spotless Mind;2004;108;tt0338013;8.3 Lawrence of Arabia;1962;216;tt0056172;8.3 A Clockwork Orange;1971;136;tt0066921;8.3 Singin' in the Rain;1952;103;tt0045152;8.3 Amelie;2001;122;tt0211915;8.3 Double Indemnity;1944;107;tt0036775;8.3 Inglourious Basterds;2009;153;tt0361748;8.3 Taxi Driver;1976;114;tt0075314;8.3 Full Metal Jacket;1987;116;tt0093058;8.3 To Kill a Mockingbird;1962;129;tt0056592;8.3 Bicycle Thieves;1948;89;tt0040522;8.3 Good Will Hunting;1997;126;tt0119217;8.3 The Kid;1921;68;tt0012349;8.3 The Sting;1973;129;tt0070735;8.3 The Hunt;2012;115;tt2106476;8.3 Toy Story 3;2010;103;tt0435761;8.3 Snatch;2000;102;tt0208092;8.3 Scarface;1983;170;tt0086250;8.3 For a Few Dollars More;1965;132;tt0059578;8.3 The Apartment;1960;125;tt0053604;8.3 Metropolis;1927;153;tt0017136;8.3 Monty Python and the Holy Grail;1975;91;tt0071853;8.3 L.A. Confidential;1997;138;tt0119488;8.3 A Separation;2011;123;tt1832382;8.3 Indiana Jones and the Last Crusade;1989;127;tt0097576;8.2 Up;2009;96;tt1049413;8.2 Rashomon;1950;88;tt0042876;8.3 All About Eve;1950;138;tt0042192;8.3 Batman Begins;2005;140;tt0372784;8.2 Some Like It Hot;1959;121;tt0053291;8.2 Yojimbo;1961;110;tt0055630;8.3 Downfall;2004;156;tt0363163;8.2 Unforgiven;1992;130;tt0105695;8.2 Die Hard;1988;132;tt0095016;8.2 Heat;1995;170;tt0113277;8.2 The Treasure of the Sierra Madre;1948;126;tt0040897;8.2 Incendies;2010;131;tt1255953;8.3 Ikiru;1952;143;tt0044741;8.3 Green Book;2018;130;tt6966692;8.3 Raging Bull;1980;129;tt0081398;8.2 The Great Escape;1963;172;tt0057115;8.2 Children of Heaven;1997;89;tt0118849;8.3 Pan's Labyrinth;2006;118;tt0457430;8.2 Chinatown;1974;130;tt0071315;8.2 My Neighbor Totoro;1988;86;tt0096283;8.2 The Third Man;1949;93;tt0041959;8.2 Howl's Moving Castle;2004;119;tt0347149;8.2 My Father and My Son;2005;108;tt0476735;8.4 Ran;1985;162;tt0089881;8.2 Judgment at Nuremberg;1961;186;tt0055031;8.2 The Secret in Their Eyes;2009;129;tt1305806;8.2 The Gold Rush;1925;95;tt0015864;8.2 A Beautiful Mind;2001;135;tt0268978;8.2 The Bridge on the River Kwai;1957;161;tt0050212;8.2 Lock, Stock and Two Smoking Barrels;1998;107;tt0120735;8.2 Casino;1995;178;tt0112641;8.2 The Seventh Seal;1957;96;tt0050976;8.2 On the Waterfront;1954;108;tt0047296;8.2 Three Billboards Outside Ebbing Missouri;2017;115;tt5027774;8.2 The Wolf of Wall Street;2013;180;tt0993846;8.2 The Elephant Man;1980;124;tt0080678;8.2 Inside Out;2015;95;tt2096673;8.2 V for Vendetta;2005;132;tt0434409;8.2 Mr. Smith Goes to Washington;1939;129;tt0031679;8.2 Room;2015;118;tt3170832;8.2 Warrior;2011;140;tt1291584;8.2 Blade Runner;1982;117;tt0083658;8.2 Dial M for Murder;1954;105;tt0046912;8.2 No Country for Old Men;2007;122;tt0477348;8.1 There Will Be Blood;2007;158;tt0469494;8.2 Andhadhun;2018;139;tt8108198;8.5 Wild Strawberries;1957;91;tt0050986;8.2 The General;1926;67;tt0017925;8.2 The Sixth Sense;1999;107;tt0167404;8.1 Trainspotting;1996;93;tt0117951;8.2 Gone with the Wind;1939;238;tt0031381;8.2 The Thing;1982;109;tt0084787;8.1 Fargo;1996;98;tt0116282;8.1 Come and See;1985;142;tt0091251;8.2 Gran Torino;2008;116;tt1205489;8.1 Finding Nemo;2003;100;tt0266543;8.1 The Deer Hunter;1978;183;tt0077416;8.1 Shutter Island;2010;138;tt1130884;8.1 The Big Lebowski;1998;117;tt0118715;8.1 Kill Bill: Vol. 1;2003;111;tt0266697;8.1 Sherlock Jr.;1924;45;tt0015324;8.2 Cool Hand Luke;1967;126;tt0061512;8.1 Tokyo Story;1953;136;tt0046438;8.2 Mary and Max;2009;92;tt0978762;8.1 Rebecca;1940;130;tt0032976;8.1 Hacksaw Ridge;2016;139;tt2119532;8.1 Jurassic Park;1993;127;tt0107290;8.1 How to Train Your Dragon;2010;98;tt0892769;8.1 Gone Girl;2014;149;tt2267998;8.1 Wild Tales;2014;122;tt3011894;8.1 The Truman Show;1998;103;tt0120382;8.1 Sunrise;1927;94;tt0018455;8.2 Stalker;1979;162;tt0079944;8.1 The Grand Budapest Hotel;2014;99;tt2278388;8.1 In the Name of the Father;1993;133;tt0107207;8.1 Stand by Me;1986;89;tt0092005;8.1 It Happened One Night;1934;105;tt0025316;8.1 Into the Wild;2007;148;tt0758758;8.1 Platoon;1986;120;tt0091763;8.1 Memories of Murder;2003;132;tt0353969;8.1 Network;1976;121;tt0074958;8.1 Monty Python's Life of Brian;1979;94;tt0079470;8.1 Ben-Hur;1959;212;tt0052618;8.1 Persona;1966;83;tt0060827;8.1 12 Years a Slave;2013;134;tt2024544;8.1 Million Dollar Baby;2004;132;tt0405159;8.1 Hotel Rwanda;2004;121;tt0395169;8.1 Before Sunrise;1995;101;tt0112471;8.1 The Bandit;1996;128;tt0116231;8.3 Neon Genesis Evangelion: The End of Evangelion;1997;90;tt0169858;8.2 Prisoners;2013;153;tt1392214;8.1 Mad Max: Fury Road;2015;120;tt1392190;8.1 The Wages of Fear;1953;131;tt0046268;8.1 Rush;2013;123;tt1979320;8.1 Hachi: A Dog's Tale;2009;93;tt1028532;8.1 Logan;2017;137;tt3315342;8.1 The 400 Blows;1959;99;tt0053198;8.1 Andrei Rublev;1966;205;tt0060107;8.2 Catch Me If You Can;2002;141;tt0264464;8.1 Spotlight;2015;129;tt1895587;8.1 The Passion of Joan of Arc;1928;114;tt0019254;8.1 Amores Perros;2000;154;tt0245712;8.1 Harry Potter and the Deathly Hallows: Part 2;2011;130;tt1201607;8.1 Nausicaa of the Valley of the Wind;1984;117;tt0087544;8.1 The Princess Bride;1987;98;tt0093779;8.1 Barry Lyndon;1975;185;tt0072684;8.1 Rocky;1976;120;tt0075148;8.1 Butch Cassidy and the Sundance Kid;1969;110;tt0064115;8.1 Rang De Basanti;2006;157;tt0405508;8.2 Monsters Inc.;2001;92;tt0198781;8.1 Dead Poets Society;1989;128;tt0097165;8.1 The Grapes of Wrath;1940;129;tt0032551;8.1 The Maltese Falcon;1941;100;tt0033870;8.1 The Terminator;1984;107;tt0088247;8 Raise the Red Lantern;1991;125;tt0101640;8.2 The Handmaiden;2016;145;tt4016934;8.1 Gandhi;1982;191;tt0083987;8.1 La Haine;1995;98;tt0113247;8.1 Donnie Darko;2001;113;tt0246578;8.1 In the Mood for Love;2000;98;tt0118694;8.1 Diabolique;1955;117;tt0046911;8.1 Groundhog Day;1993;101;tt0107048;8 The Help;2011;146;tt1454029;8.1 The Wizard of Oz;1939;102;tt0032138;8 Jaws;1975;124;tt0073195;8 Guardians of the Galaxy;2014;121;tt2015381;8.1 Before Sunset;2004;80;tt0381681;8.1 Castle in the Sky;1986;125;tt0092067;8.1 Paris Texas;1984;145;tt0087884;8.1 Pirates of the Caribbean: The Curse of the Black Pearl;2003;143;tt0325980;8 The Nights of Cabiria;1957;110;tt0050783;8.1 Beauty and the Beast;1991;84;tt0101414;8 The Exorcist;1973;122;tt0070047;8 Three Colors: Red;1994;99;tt0111495;8.1 Akira;1988;124;tt0094625;8.1 Gangs of Wasseypur;2012;321;tt1954470;8.2 PK;2014;153;tt2338151;8.2
movies.sql
Description: Binary data
users.sql
Description: Binary data
reviews.sql
Description: Binary data
ERROR 404 NOT FOUND
{% endblock %} {% block body %}ERROR 404 NOT FOUND
{{message}} {% endblock %} {% extends "layout.html" %} {% block title %}ERROR 404 NOT FOUND
{% endblock %} {% block body %}ERROR 404 NOT FOUND
{{message}} {% endblock %} {% extends "layout.html" %} {% block title %}ERROR! You have already submitted a review for this movie
{% endblock %} {% block body %}ERROR! You have already submitted a review for this movie
{{message}} {% endblock %} {% extends "layout.html" %} {% block title %} Login/Registration {% endblock %} {% block body %}Hi, welcome to Movie Reviewer. This website is created by yourfavouriteguy. Kindly Login or Register first!
Username:
{{message}}
Password:
{{message}}
Password:
If you have registered, please login!
Name:
Password:
{% block body %}
{% endblock %}
{% extends "layout.html" %}
{% block title %}
{% endblock %}
{% block body %}
Movie Details
-
Title: {{movie[0].strip("('')")}}
Year: {{movie[1]}}
Runtime: {{movie[2]}} minutes
ImdbID: {{movie[3].strip("' '")}}
ImdbRating: {{movie[4].strip("Decimal( )'")}}
Input your review!(if you have any)
Rating: 1 2 3 4 5 6 7 8 9 10Review:
{% endblock %} {% extends "layout.html" %} {% block title %} {% endblock %} {% block body %}
Movie Details
-
Title:     {{movie[0].strip("('')")}}
Year:     {{movie[1]}}
Runtime:     {{movie[2]}} minutes
ImdbID:     {{movie[3].strip("' '")}}
ImdbRating:     {{movie[4].strip("Decimal( )'")}}
Plot:    {{omdb_data['Plot']}}
Rated:    {{omdb_data['Rated']}}
Released:    {{omdb_data['Released']}}
Genre:    {{omdb_data['Genre']}}
Director:    {{omdb_data['Director']}}
Writer:    {{omdb_data['Writer']}}
Actors:    {{omdb_data['Actors']}}
Language:    {{omdb_data['Language']}}
Country:    {{omdb_data['Country']}}
Awards:    {{omdb_data['Awards']}}
Poster:    {{omdb_data['Poster']}}
Ratings:
{% for rating in ratings_list %}
Source = {{rating['Source']}}
Value = {{rating['Value']}}
Metascore:    {{omdb_data['Metascore']}}
ImdbVotes:    {{omdb_data['imdbVotes']}}
Type:    {{omdb_data['Type']}}
DVD:    {{omdb_data['DVD']}}
BoxOffice:    {{omdb_data['BoxOffice']}}
Production:    {{omdb_data['Production']}}
Website:    {{omdb_data['Website']}}
Existing Reviews:
User: {{check_for_review[2].strip("' '")}}
Rating: {{check_for_review[1].strip("'Decimal('') '")}}/10
Review: {{check_for_review[3].strip("' ')]")}}
Input your review!(if you have any)
Rating: 1 2 3 4 5 6 7 8 9 10Review:
{% endblock %} {% extends "layout.html" %} {% block title %} {% endblock %} {% block body %}
Movie Details
-
Title:     {{movie[0].strip("('')")}}
Year:     {{movie[1]}}
Runtime:     {{movie[2]}} minutes
ImdbID:     {{movie[3].strip("' '")}}
ImdbRating:     {{movie[4].strip("Decimal( )'")}}
Plot:    {{omdb_data['Plot']}}
Rated:    {{omdb_data['Rated']}}
Released:    {{omdb_data['Released']}}
Genre:    {{omdb_data['Genre']}}
Director:    {{omdb_data['Director']}}
Writer:    {{omdb_data['Writer']}}
Actors:    {{omdb_data['Actors']}}
Language:    {{omdb_data['Language']}}
Country:    {{omdb_data['Country']}}
Awards:    {{omdb_data['Awards']}}
Poster:    {{omdb_data['Poster']}}
Ratings:
{% for rating in ratings_list %}
Source = {{rating['Source']}}
Value = {{rating['Value']}}
Metascore:    {{omdb_data['Metascore']}}
ImdbVotes:    {{omdb_data['imdbVotes']}}
Type:    {{omdb_data['Type']}}
DVD:    {{omdb_data['DVD']}}
BoxOffice:    {{omdb_data['BoxOffice']}}
Production:    {{omdb_data['Production']}}
Website:    {{omdb_data['Website']}}
Input your review!(if you have any)
Rating: 1 2 3 4 5 6 7 8 9 10Review:
{% endblock %} {% extends "layout.html" %} {% block title %} {% endblock %} {% block body %}
Movie Details
-
Title: {{movie[0].strip("('')")}}
Year: {{movie[1]}}
Runtime: {{movie[2]}} minutes
ImdbID: {{movie[3].strip("' '")}}
ImdbRating: {{movie[4].strip("Decimal( )'")}}
Existing Reviews:
User: {{check_for_review[2].strip("' '")}}
Rating: {{check_for_review[1].strip("'Decimal('') '")}}/10
Review: {{check_for_review[3].strip("' ')]")}}
Input your review!(if you have any)
Rating: 1 2 3 4 5 6 7 8 9 10Review:
{% endblock %} {% block body %}
All Movies Related to Search:
-
{% for movie in movie_specific %}
- Here's a movie called {{movie.title}} and lasts for {{movie.runtime}} minutes. It was shot in the year {{movie.year}} and has the imdbID of {{movie.imdbID}}. Its rating is {{movie.imdbRating}}. {% endfor %}
All Movies
Search for a movie
-
{% for movie in movies %}
- {{movie.title}} lasts for {{movie.runtime}} minutes. It was shot in the year {{movie.year}} and has the imdbID of {{movie.imdbID}}. Its rating is {{movie.imdbRating}}. {% endfor %}
Search:
Input Movie Name:
Or
Input Year of Release:
Or
Input IMDB ID:
{% endblock %}
Or
Input Year of Release:
Or
Input IMDB ID: