Hi, I got the same error even after adding that. ######################### Traceback (most recent call last): File "import.py", line 30, in <module> main() File "import.py", line 22, in main year = int(row[1]) IndexError: list index out of range Thanks, Cravan On 13/6/19, 8:53 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote:
You have an empty row in your CSV file (maybe a blank line at the end?). Try adding this at the beginning of your loop: if not row: continue On Thu, Jun 13, 2019 at 1:26 PM Cravan <cravan...@gmail.com> wrote: > > Thanks Simon, I got a new error this time: > ##################### > Traceback (most recent call last): > File "import.py", line 28, in <module> > main() > File "import.py", line 20, in main > year = int(row[1]) > IndexError: list index out of range > > Thanks, > Cravan > > On 13/6/19, 8:19 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > It's worth pointing out that your first and last errors are database > errors from postgresql, whereas the middle syntax error was a Python > error. > > In Python, single and double-quotes are interchangeable, and you can > use whichever is more convenient for you. This is not true for > postgresql. In PG, single quotes are used for strings, and > double-quotes are used for identifiers that you want to be treated > literally (eg. because they contain characters that aren't normally > allowed in identifiers, or because you want them to be > case-sensitive). > > So in this case, you need imdbID and imdbRating to be surrounded by > double-quotes because you want them to be handled as case-sensitive. > The easiest thing to do is to change the quotes around the whole SQL > statement to be single quotes. > > ie. > > sqlalchemy.text('INSERT INTO movies(title, year, runtime, "imdbID", > "imdbRating") VALUES(...)') > > Simon > > On Thu, Jun 13, 2019 at 12:40 PM Cravan <cravan...@gmail.com> wrote: > > > > Alright, thanks because I created my sql column names with imdbID, which contains caps. > > However, after changing it to single-quotes, I got a syntax error. > > ################################### > > Traceback (most recent call last): > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_conte > > xt > > cursor, statement, parameters, context > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/default.py", line 550, in do_execute > > cursor.execute(statement, parameters) > > psycopg2.errors.SyntaxError: syntax error at or near "'imdbID'" > > LINE 1: INSERT INTO movies(title, year, runtime, 'imdbID', 'imdbRati... > > ^ > > > > > > The above exception was the direct cause of the following exception: > > Traceback (most recent call last): > > File "import.py", line 28, in <module> > > main() > > File "import.py", line 25, in main > > engine.execute(insert_statement, title=title, year=year, runtime=ru > > ntime, imdbID=imdbID, imdbRating=imdbRating) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 2166, in execute > > return connection.execute(statement, *multiparams, **params) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 988, in execute > > return meth(self, multiparams, params) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_co > > nnection > > return connection._execute_clauseelement(self, multiparams, params) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_claus > > eelement > > distilled_params, > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_conte > > xt > > e, statement, parameters, cursor, context > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_ > > exception > > util.raise_from_cause(sqlalchemy_exception, exc_info) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_caus > > e > > reraise(type(exception), exception, tb=exc_tb, cause=cause) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/util/compat.py", line 128, in reraise > > raise value.with_traceback(tb) > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_conte > > xt > > cursor, statement, parameters, context > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7 > > /site-packages/sqlalchemy/engine/default.py", line 550, in do_execute > > cursor.execute(statement, parameters) > > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) syntax e > > rror at or near "'imdbID'" > > LINE 1: INSERT INTO movies(title, year, runtime, 'imdbID', 'imdbRati... > > [SQL: INSERT INTO movies(title, year, runtime, 'imdbID', 'imdbRating') > > VALUES (%(title)s, %(year)s, %(runtime)s, %(imdbID)s, %(imdbRating)s)] > > [parameters: {'title': 'The Lego Movie', 'year': 2014, 'runtime': 100, > > 'imdbID': 'tt1490017', 'imdbRating': 7.8}] > > (Background on this error at: http://sqlalche.me/e/f405) > > Thanks, > > Cravan > > > > > > > > On 13/6/19, 7:36 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > > > You've got double-quotes around "imdbID" and "imdbRating" on that > > line, and double-quotes around the SQL statement, which is a syntax > > error. I think you should be able to just remove the quotes around the > > column names, but if you really need them for some reason, replace the > > outer double-quotes with single-quotes. > > > > Simon > > > > On Thu, Jun 13, 2019 at 12:20 PM Cravan <cravan...@gmail.com> wrote: > > > > > > I got a new error after using Simon's suggestion, would someone help me? > > > ###################################### > > > File "import.py", line 24 > > > insert_statement = sqlalchemy.text("INSERT INTO movies(title, year, > > > runtime, "imdbID", "imdbRating") VALUES (:title, :year, :runtime, :imd > > > bID, :imdbRating)") > > > > > > ^ > > > SyntaxError: invalid syntax > > > Thanks, > > > Cravan > > > On 13/6/19, 7:10 PM, "Simon King" <sqlalchemy@googlegroups.com on behalf of si...@simonking.org.uk> wrote: > > > > > > Your "engine.execute" statement looks wrong to me: > > > > > > engine.execute('INSERT INTO > > > movies("title","year","runtime","imdbID","imdbRating") VALUES > > > ((title), (year), (runtime), (imdbID), (imdbRating))', > > > {"title": title, "year": year, "runtime": runtime, "imdbID": > > > imdbID, "imdbRating": imdbRating }) > > > > > > In particular, the VALUES clause is wrong. That's not the way that you > > > specify parameters when executing a parametrized query, so the > > > database is interpreting "(title)" as a reference to a column, rather > > > than a reference to a parameter. > > > > > > You're probably best off using SQLAlchemy's text() construct: > > > > > > https://docs.sqlalchemy.org/en/13/core/tutorial.html#using-textual-sql > > > > > > You would put this outside the loop: > > > > > > insert_statement = sqlalchemy.text( > > > "INSERT INTO movies(title, year, runtime, imdbID, imdbRating) > > > VALUES (:title, :year, :runtime, :imdbID, :imdbRating)" > > > ) > > > > > > and then inside the loop you would use: > > > > > > engine.execute(insert_statement, title=title, year=year, > > > runtime=runtime, imdbID=imdbID, imdbRating=imdbRating) > > > > > > Also, I suspect (but haven't verified) that "engine.execute()" will > > > check out a connection from the pool, run the statement, and commit a > > > transaction. If you want to import all the rows in a single > > > transaction, you should probably explicitly create a connection at the > > > beginning, use "connection.execute()" to run your SQL, and commit it > > > at the end. See > > > https://docs.sqlalchemy.org/en/13/core/connections.html#using-transactions > > > for examples. > > > > > > Hope that helps, > > > > > > Simon > > > > > > > > > On Thu, Jun 13, 2019 at 11:15 AM Cravan <cravan...@gmail.com> wrote: > > > > > > > > I'm getting a weird error code when I try to store values from a csv into an sql table in a movie review assignment. > > > > > > > > I have already edited my apostrophes and spacing and looked up examples from google to try and resolve my error to no avail. I also ensured that i defined DATABASE_URL properly. Sorry for the long traceback error at the end :P Please note that my csv values are stored in lists in each cell. They are arranged in a single column such as > > > > > > > > The Lego Movie;2014;100;tt1490017;7.8 > > > > > > > > This is my main code > > > > > > > > import csv > > > > import sys > > > > import os > > > > 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 > > > > title = row[0] > > > > year = int(row[1]) > > > > runtime = int(row[2]) > > > > imdbID = row[3] > > > > imdbRating = float(row[4]) > > > > engine.execute('INSERT INTO movies("title","year","runtime","imdbID","imdbRating") VALUES ((title), (year), (runtime), (imdbID), (imdbRating))', > > > > {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "imdbRating": imdbRating }) > > > > engine.commit() # transactions are assumed, so close the transaction finished > > > > if __name__ == "__main__": > > > > main() > > > > > > > > SQL code: > > > > > > > > CREATE TABLE movies ( > > > > "title" SERIAL PRIMARY KEY, > > > > "year" INTEGER NOT NULL, > > > > "runtime" INTEGER NOT NULL, > > > > "imdbID" VARCHAR NOT NULL, > > > > "imdbRating" INTEGER NOT NULL > > > > ); > > > > > > > > New error code: > > > > > > > > Traceback (most recent call last): > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 1244, in _execute_context > > > > cursor, statement, parameters, context > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/default.py", line 550, in do_execute > > > > cursor.execute(statement, parameters) > > > > psycopg2.errors.UndefinedColumn: column "title" does not exist > > > > LINE 1: ...,"year","runtime","imdbID","imdbRating") VALUES ((title), (y... > > > > ^ > > > > HINT: There is a column named "title" in table "movies", but it cannot be re > > > > ferenced from this part of the query. > > > > > > > > > > > > The above exception was the direct cause of the following exception: > > > > Traceback (most recent call last): > > > > File "import.py", line 26, in <module> > > > > main() > > > > File "import.py", line 23, in main > > > > {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "imd > > > > bRating": imdbRating }) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 2166, in execute > > > > return connection.execute(statement, *multiparams, **params) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 982, in execute > > > > return self._execute_text(object_, multiparams, params) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 1155, in _execute_text > > > > parameters, > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 1248, in _execute_context > > > > e, statement, parameters, cursor, context > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception > > > > util.raise_from_cause(sqlalchemy_exception, exc_info) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause > > > > reraise(type(exception), exception, tb=exc_tb, cause=cause) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/util/compat.py", line 128, in reraise > > > > raise value.with_traceback(tb) > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/base.py", line 1244, in _execute_context > > > > cursor, statement, parameters, context > > > > File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- > > > > packages/sqlalchemy/engine/default.py", line 550, in do_execute > > > > cursor.execute(statement, parameters) > > > > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "ti > > > > tle" does not exist > > > > LINE 1: ...,"year","runtime","imdbID","imdbRating") VALUES ((title), (y... > > > > ^ > > > > HINT: There is a column named "title" in table "movies", but it cannot be re > > > > ferenced from this part of the query. > > > > > > > > [SQL: INSERT INTO movies("title","year","runtime","imdbID","imdbRating") VALU > > > > ES ((title), (year), (runtime), (imdbID), (imdbRating))] > > > > [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbID > > > > ': 'imdbID', 'imdbRating': 'imdbRating\n'}] > > > > (Background on this error at: http://sqlalche.me/e/f405) > > > > > > > > -- > > > > 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/ca1b1197-3f05-4572-a11a-fda4e08d27f3%40googlegroups.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/CAFHwexcqMjc_vUtNhx-dpyS6ECK5TSDeObDEGzeOFR1n35JkdQ%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/2E8C06E7-BD2D-408A-BFE4-6657C5270CF5%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/CAFHwexexCE%3DpS-wP6Nxbd2znhesjwtuzt1zjodPytdiKF-x7uQ%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/4E9096F6-7FD9-4AAF-A045-0DBCE352FE9F%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/CAFHwexeK05VEPLk1cLH2iq0tSzpunWViNd2DRCDLZdQi_H85xA%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/ECE19F5A-993C-4063-957F-C198A1591A13%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/CAFHwexeAZ4SYJGD_zmh0NV97RtMER1Cq5Cr7FM%3D-5TeAAX1_vQ%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/A8B78051-BE1B-4D1B-BEAB-01F595138DE3%40gmail.com. For more options, visit https://groups.google.com/d/optout.
summative3.sql
Description: Binary data
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 title = row[0] year = int(row[1]) runtime = int(row[2]) imdbID = row[3] imdbRating = float(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) engine.commit() # transactions are assumed, so close the transaction finished if __name__ == "__main__": main()
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