Thread

  1. Error when doing sql

    Cravan <savageapple850@gmail.com> — 2019-06-12T10:48:29Z

    Hi all, 
    
                    Thank you for your replies. Now, 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. 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
    
     Please refer to the files attached. Here is the error code I’m getting:
    
     
    
    ######################################
    
    ````
    
    Traceback (most recent call last):
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does not exist
    
    LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    
                               ^
    
     
    
     
    
    The above exception was the direct cause of the following exception:
    
     
    
    Traceback (most recent call last):
    
    File "import.py", line 22, in <module>
    
        main()
    
      File "import.py", line 18, in main
    
        {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID, 'imdbRating
    
    ': imdbRating}) # substitute values from CSV line into SQL command, as per this dict
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package
    
    s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    
        parameters,
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "title" of
    
     relation "movies" does not exist
    
    LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    
                               ^
    
     
    
    [SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES ((title),
    
    (year), (runtime), (imdbID), (imdbRating))]
    
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbID': 'imd
    
    bID', 'imdbRating': 'imdbRating\n'}]
    
    (Background on this error at: http://sqlalche.me/e/f405)
    
    ````
    
    
  2. Re: Error when doing sql

    Adarsh Jaiswal <adarshjaiswal1989@gmail.com> — 2019-06-12T11:50:24Z

    Hi,
    
    Try adding double quotes around the column names in the query.
    
    Thanks and Regards,
    Adarsh Jaiswal
    
    
    On Wed, Jun 12, 2019 at 4:20 PM Cravan <savageapple850@gmail.com> wrote:
    
    > Hi all,
    >
    >                 Thank you for your replies. Now, 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. 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
    >
    > Please refer to the files attached. Here is the error code I’m getting:
    >
    >
    >
    > ######################################
    >
    > ````
    >
    > Traceback (most recent call last):
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does
    > not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    >
    >
    > The above exception was the direct cause of the following exception:
    >
    >
    >
    > Traceback (most recent call last):
    >
    > File "import.py", line 22, in <module>
    >
    >     main()
    >
    >   File "import.py", line 18, in main
    >
    >     {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID,
    > 'imdbRating
    >
    > ': imdbRating}) # substitute values from CSV line into SQL command, as per
    > this dict
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    >
    >     parameters,
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column
    > "title" of
    >
    > relation "movies" does not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    > [SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES
    > ((title),
    >
    > (year), (runtime), (imdbID), (imdbRating))]
    >
    > [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime',
    > 'imdbID': 'imd
    >
    > bID', 'imdbRating': 'imdbRating\n'}]
    >
    > (Background on this error at: http://sqlalche.me/e/f405)
    >
    > ````
    >
    
  3. Re: Error when doing sql

    Anthony E . Greene <agreene@pobox.com> — 2019-06-12T12:06:53Z

    On 12-Jun-2019/18:48 +0800, Cravan <savageapple850@gmail.com> wrote:
    >Hi all, 
    >
    >                Thank you for your replies. Now, 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. 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
    
    One problem is that the table definition says imdbRating is an integer,
    but the value in your example (7.8) is not an integer.
    
    
    >
    > Please refer to the files attached. Here is the error code I’m getting:
    >
    > 
    >
    >######################################
    >
    >````
    >
    >Traceback (most recent call last):
    >
    >  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    >s/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-package
    >
    >s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >    cursor.execute(statement, parameters)
    >
    >psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does not exist
    >
    >LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                           ^
    >
    > 
    >
    > 
    >
    >The above exception was the direct cause of the following exception:
    >
    > 
    >
    >Traceback (most recent call last):
    >
    >File "import.py", line 22, in <module>
    >
    >    main()
    >
    >  File "import.py", line 18, in main
    >
    >    {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID, 'imdbRating
    >
    >': imdbRating}) # substitute values from CSV line into SQL command, as per this dict
    >
    >  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    >s/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-package
    >
    >s/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-package
    >
    >s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    >
    >    parameters,
    >
    >  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    >s/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-package
    >
    >s/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-package
    >
    >s/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-package
    >
    >s/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-package
    >
    >s/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-package
    >
    >s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >    cursor.execute(statement, parameters)
    >
    >sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "title" of
    >
    > relation "movies" does not exist
    >
    >LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                           ^
    >
    > 
    >
    >[SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES ((title),
    >
    >(year), (runtime), (imdbID), (imdbRating))]
    >
    >[parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbID': 'imd
    >
    >bID', 'imdbRating': 'imdbRating\n'}]
    >
    >(Background on this error at: http://sqlalche.me/e/f405)
    >
    >````
    >
    
    >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)
    >    for row in f: # loop gives each column a name
    >        title,year,runtime,imdbID,imdbRating = row.split(';')
    >        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}) # substitute values from CSV line into SQL command, as per this dict
    >
    >    engine.commit() # transactions are assumed, so close the transaction finished
    >if __name__ == "__main__":
    >    main()
    
    
    
    -- 
    Anthony E. Greene <mailto:agreene@pobox.com>
    
    
    
    
    
  4. Re: Error when doing sql

    Adarsh Jaiswal <adarshjaiswal1989@gmail.com> — 2019-06-12T12:07:00Z

    Hello Cravan,
    
    I meant the insert statement in the .py file.
    
    Thanks and Regards,
    Adarsh Jaiswal
    
    
    On Wed, Jun 12, 2019 at 5:23 PM Cravan <savageapple850@gmail.com> wrote:
    
    > Hi Adarsh,
    >
    >                 Do you mean that I should do so in the .py file or the
    > .sql file?
    >
    > Thanks and Regards,
    >
    > Cravan
    >
    >
    >
    > *From: *cool kid <savageapple850@gmail.com>
    > *Date: *Wednesday, 12 June 2019 at 7:51 PM
    > *To: *Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    > *Subject: *Re: Error when doing sql
    >
    >
    >
    > You mean in the py file?
    >
    >
    >
    > *From: *Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    > *Date: *Wednesday, 12 June 2019 at 7:50 PM
    > *To: *cool kid <savageapple850@gmail.com>
    > *Cc: *"pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    > *Subject: *Re: Error when doing sql
    >
    >
    >
    > Hi,
    >
    >
    >
    > Try adding double quotes around the column names in the query.
    >
    >
    > Thanks and Regards,
    >
    > Adarsh Jaiswal
    >
    >
    >
    >
    >
    > On Wed, Jun 12, 2019 at 4:20 PM Cravan <savageapple850@gmail.com> wrote:
    >
    > Hi all,
    >
    >                 Thank you for your replies. Now, 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. 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
    >
    > Please refer to the files attached. Here is the error code I’m getting:
    >
    >
    >
    > ######################################
    >
    > ````
    >
    > Traceback (most recent call last):
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does
    > not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    >
    >
    > The above exception was the direct cause of the following exception:
    >
    >
    >
    > Traceback (most recent call last):
    >
    > File "import.py", line 22, in <module>
    >
    >     main()
    >
    >   File "import.py", line 18, in main
    >
    >     {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID,
    > 'imdbRating
    >
    > ': imdbRating}) # substitute values from CSV line into SQL command, as per
    > this dict
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    >
    >     parameters,
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column
    > "title" of
    >
    > relation "movies" does not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    > [SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES
    > ((title),
    >
    > (year), (runtime), (imdbID), (imdbRating))]
    >
    > [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime',
    > 'imdbID': 'imd
    >
    > bID', 'imdbRating': 'imdbRating\n'}]
    >
    > (Background on this error at: http://sqlalche.me/e/f405)
    >
    > ````
    >
    >
    
  5. Re: Error when doing sql

    Cravan <savageapple850@gmail.com> — 2019-06-12T12:13:25Z

    Hi Adarsh,
    
                    I am still getting the same error.
    
    ##############################################
    
    Traceback (most recent call last):
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does not exist
    
    LINE 1: INSERT INTO movies("title", "year", "runtime", "imdbID", "im...
    
                               ^
    
    The above exception was the direct cause of the following exception:
    
     
    
    Traceback (most recent call last):
    
      File "import.py", line 22, in <module>
    
        main()
    
      File "import.py", line 18, in main
    
        {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID, 'imdbRating
    
    ': imdbRating}) # substitute values from CSV line into SQL command, as per this dict
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package 
    
    s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    
        parameters,
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "title" of
    
     relation "movies" does not exist
    
    LINE 1: INSERT INTO movies("title", "year", "runtime", "imdbID", "im...
    
                               ^
    
     
    
    [SQL: INSERT INTO movies("title", "year", "runtime", "imdbID", "imdbRating") VALUES
    
    ((title), (year), (runtime), (imdbID), (imdbRating))]
    
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbID': 'imd
    
    bID', 'imdbRating': 'imdbRating\n'}]
    
    (Background on this error at: http://sqlalche.me/e/f405)
    
     
    
     
    
    Cravan
    
     
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 8:07 PM
    To: cool kid <savageapple850@gmail.com>, "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
     
    
    Hello Cravan,
    
     
    
    I meant the insert statement in the .py file.
    
    
    Thanks and Regards,
    
    Adarsh Jaiswal
    
     
    
     
    
    On Wed, Jun 12, 2019 at 5:23 PM Cravan <savageapple850@gmail.com> wrote:
    
    Hi Adarsh,
    
                    Do you mean that I should do so in the .py file or the .sql file?
    
    Thanks and Regards,
    
    Cravan
    
     
    
    From: cool kid <savageapple850@gmail.com>
    Date: Wednesday, 12 June 2019 at 7:51 PM
    To: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Subject: Re: Error when doing sql
    
     
    
    You mean in the py file?
    
     
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 7:50 PM
    To: cool kid <savageapple850@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
     
    
    Hi,
    
     
    
    Try adding double quotes around the column names in the query.
    
    
    Thanks and Regards,
    
    Adarsh Jaiswal
    
     
    
     
    
    On Wed, Jun 12, 2019 at 4:20 PM Cravan <savageapple850@gmail.com> wrote:
    
    Hi all, 
    
                    Thank you for your replies. Now, 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. 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
    
    Please refer to the files attached. Here is the error code I’m getting:
    
     
    
    ######################################
    
    ````
    
    Traceback (most recent call last):
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does not exist
    
    LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    
                               ^
    
     
    
     
    
    The above exception was the direct cause of the following exception:
    
     
    
    Traceback (most recent call last):
    
    File "import.py", line 22, in <module>
    
        main()
    
      File "import.py", line 18, in main
    
        {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID, 'imdbRating
    
    ': imdbRating}) # substitute values from CSV line into SQL command, as per this dict
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package
    
    s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    
        parameters,
    
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/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-package
    
    s/sqlalchemy/engine/default.py", line 550, in do_execute
    
        cursor.execute(statement, parameters)
    
    sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "title" of
    
    relation "movies" does not exist
    
    LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    
                               ^
    
     
    
    [SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES ((title),
    
    (year), (runtime), (imdbID), (imdbRating))]
    
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbID': 'imd
    
    bID', 'imdbRating': 'imdbRating\n'}]
    
    (Background on this error at: http://sqlalche.me/e/f405)
    
    ````
    
    
  6. Re: Error when doing sql

    Adarsh Jaiswal <adarshjaiswal1989@gmail.com> — 2019-06-12T12:35:56Z

    Hi,
    
    Would you check the table created in postgresql, may be using "\d+
    tablename" and post the response here ?
    
    Thanks and Regards,
    Adarsh Jaiswal
    
    
    On Wed, Jun 12, 2019 at 5:43 PM Cravan <savageapple850@gmail.com> wrote:
    
    > Hi Adarsh,
    >
    >                 I am still getting the same error.
    >
    > ##############################################
    >
    > Traceback (most recent call last):
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does
    > not exist
    >
    > LINE 1: INSERT INTO movies("title", "year", "runtime", "imdbID", "im...
    >
    >                            ^
    >
    > The above exception was the direct cause of the following exception:
    >
    >
    >
    > Traceback (most recent call last):
    >
    >   File "import.py", line 22, in <module>
    >
    >     main()
    >
    >   File "import.py", line 18, in main
    >
    >     {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID,
    > 'imdbRating
    >
    > ': imdbRating}) # substitute values from CSV line into SQL command, as per
    > this dict
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    >
    >     parameters,
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column
    > "title" of
    >
    > relation "movies" does not exist
    >
    > LINE 1: INSERT INTO movies("title", "year", "runtime", "imdbID", "im...
    >
    >                            ^
    >
    >
    >
    > [SQL: INSERT INTO movies("title", "year", "runtime", "imdbID",
    > "imdbRating") VALUES
    >
    > ((title), (year), (runtime), (imdbID), (imdbRating))]
    >
    > [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime',
    > 'imdbID': 'imd
    >
    > bID', 'imdbRating': 'imdbRating\n'}]
    >
    > (Background on this error at: http://sqlalche.me/e/f405)
    >
    >
    >
    >
    >
    > Cravan
    >
    >
    >
    > *From: *Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    > *Date: *Wednesday, 12 June 2019 at 8:07 PM
    > *To: *cool kid <savageapple850@gmail.com>, "pgsql-novice@postgresql.org" <
    > pgsql-novice@postgresql.org>
    > *Subject: *Re: Error when doing sql
    >
    >
    >
    > Hello Cravan,
    >
    >
    >
    > I meant the insert statement in the .py file.
    >
    >
    > Thanks and Regards,
    >
    > Adarsh Jaiswal
    >
    >
    >
    >
    >
    > On Wed, Jun 12, 2019 at 5:23 PM Cravan <savageapple850@gmail.com> wrote:
    >
    > Hi Adarsh,
    >
    >                 Do you mean that I should do so in the .py file or the
    > .sql file?
    >
    > Thanks and Regards,
    >
    > Cravan
    >
    >
    >
    > *From: *cool kid <savageapple850@gmail.com>
    > *Date: *Wednesday, 12 June 2019 at 7:51 PM
    > *To: *Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    > *Subject: *Re: Error when doing sql
    >
    >
    >
    > You mean in the py file?
    >
    >
    >
    > *From: *Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    > *Date: *Wednesday, 12 June 2019 at 7:50 PM
    > *To: *cool kid <savageapple850@gmail.com>
    > *Cc: *"pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    > *Subject: *Re: Error when doing sql
    >
    >
    >
    > Hi,
    >
    >
    >
    > Try adding double quotes around the column names in the query.
    >
    >
    > Thanks and Regards,
    >
    > Adarsh Jaiswal
    >
    >
    >
    >
    >
    > On Wed, Jun 12, 2019 at 4:20 PM Cravan <savageapple850@gmail.com> wrote:
    >
    > Hi all,
    >
    >                 Thank you for your replies. Now, 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. 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
    >
    > Please refer to the files attached. Here is the error code I’m getting:
    >
    >
    >
    > ######################################
    >
    > ````
    >
    > Traceback (most recent call last):
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > psycopg2.errors.UndefinedColumn: column "title" of relation "movies" does
    > not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    >
    >
    > The above exception was the direct cause of the following exception:
    >
    >
    >
    > Traceback (most recent call last):
    >
    > File "import.py", line 22, in <module>
    >
    >     main()
    >
    >   File "import.py", line 18, in main
    >
    >     {'title': title, 'year': year, 'runtime': runtime, 'imdbID': imdbID,
    > 'imdbRating
    >
    > ': imdbRating}) # substitute values from CSV line into SQL command, as per
    > this dict
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/base.py", line 1155, in _execute_text
    >
    >     parameters,
    >
    >   File
    > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/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-package
    >
    > s/sqlalchemy/engine/default.py", line 550, in do_execute
    >
    >     cursor.execute(statement, parameters)
    >
    > sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column
    > "title" of
    >
    > relation "movies" does not exist
    >
    > LINE 1: INSERT INTO movies(title, year, runtime, imdbID, imdbRating)...
    >
    >                            ^
    >
    >
    >
    > [SQL: INSERT INTO movies(title, year, runtime, imdbID, imdbRating) VALUES
    > ((title),
    >
    > (year), (runtime), (imdbID), (imdbRating))]
    >
    > [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime',
    > 'imdbID': 'imd
    >
    > bID', 'imdbRating': 'imdbRating\n'}]
    >
    > (Background on this error at: http://sqlalche.me/e/f405)
    >
    > ````
    >
    >
    
  7. Re: Error when doing sql

    Cravan <savageapple850@gmail.com> — 2019-06-12T13:06:31Z

    Hi, here is the table:
    
     
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <savageapple850@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
     
    
    \d+ tablename
    
    
  8. RE: Error when doing sql

    Gubba, Aruna <agubba@eprod.com> — 2019-06-12T13:10:41Z

    Cravan,
    Postgres is case-sensitive, and the columns names in your insert statement should exactly match the table definition.
    Your insert into statement should look like this, (surround the exact column name around double quotes)
    Insert into movies(“Title”,”Year”, “Runtime”,”imdbID”, “imdbRating”)
    
    Thank you,
    
    Aruna Gubba
    
    From: Cravan <savageapple850@gmail.com>
    Sent: Wednesday, June 12, 2019 8:07 AM
    To: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
    Hi, here is the table:[cid:image001.png@01D520F6.532A9180]
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com<mailto:adarshjaiswal1989@gmail.com>>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <savageapple850@gmail.com<mailto:savageapple850@gmail.com>>
    Cc: "pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>" <pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>>
    Subject: Re: Error when doing sql
    
    \d+ tablename
    
    ________________________________
    
    This message (including any attachments) is confidential and intended for a specific individual and purpose. If you are not the intended recipient, please notify the sender immediately and delete this message.
    
  9. Re: Error when doing sql

    Cravan <savageapple850@gmail.com> — 2019-06-12T13:14:41Z

    Hi Aruna,
    
                    I have done what you suggested, and got a similar error with a “hint” this time
    
    ###############################
    
    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: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
    
                                                                 ^
    
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
     
    
     
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
    
      File "import.py", line 22, in <module>
    
        main()
    
      File "import.py", line 18, in main
    
        {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "im
    
    dbRating:": imdbRating }) # substitute values from CSV line into SQL command
    
    , as per this dict
    
      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 "t
    
    itle" does not exist
    
    LINE 1: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
    
                                                                 ^
    
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
     
    
    [SQL: INSERT INTO movies("Title", "Year", "Runtime", "imdbID", "imdbRating")
    
     VALUES ((title), (year), (runtime), (imdbID), (imdbRating))]
    
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbI
    
    D': 'imdbID', 'imdbRating:': 'imdbRating\n'}]
    
    (Background on this error at: http://sqlalche.me/e/f405)
    
    Thanks,
    
    Cravan
    
    From: "Gubba, Aruna" <AGubba@eprod.com>
    Date: Wednesday, 12 June 2019 at 9:10 PM
    To: cool kid <savageapple850@gmail.com>, Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: RE: Error when doing sql
    
     
    
    Cravan,
    
    Postgres is case-sensitive, and the columns names in your insert statement should exactly match the table definition.
    
    Your insert into statement should look like this, (surround the exact column name around double quotes)
    
    Insert into movies(“Title”,”Year”, “Runtime”,”imdbID”, “imdbRating”)
    
     
    
    Thank you,
    
     
    
    Aruna Gubba
    
     
    
    From: Cravan <savageapple850@gmail.com> 
    Sent: Wednesday, June 12, 2019 8:07 AM
    To: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
     
    
    Hi, here is the table:
    
     
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <savageapple850@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
     
    
    \d+ tablename
    
     
    
    
    This message (including any attachments) is confidential and intended for a specific individual and purpose. If you are not the intended recipient, please notify the sender immediately and delete this message.
    
    
    
  10. RE: Error when doing sql

    Gubba, Aruna <agubba@eprod.com> — 2019-06-12T13:25:51Z

    Cravan,
    I am not new to SQL, but new to Postgres and python scripting. I suspect somewhere in your python script there is still a reference to “title” instead “Title”, and you might want to search for that. I have been working with PgAdmin, but not worked with psql or python yet.
    Hope someone can help you troubleshoot the problem.
    
    Thank you,
    
    Aruna Gubba
    
    From: Cravan <savageapple850@gmail.com>
    Sent: Wednesday, June 12, 2019 8:15 AM
    To: Gubba, Aruna <AGubba@eprod.com>; Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
    Hi Aruna,
                    I have done what you suggested, and got a similar error with a “hint” this time
    ###############################
    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: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
                                                                 ^
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
    
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
      File "import.py", line 22, in <module>
        main()
      File "import.py", line 18, in main
        {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "im
    dbRating:": imdbRating }) # substitute values from CSV line into SQL command
    , as per this dict
      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 "t
    itle" does not exist
    LINE 1: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
                                                                 ^
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
    [SQL: INSERT INTO movies("Title", "Year", "Runtime", "imdbID", "imdbRating")
    VALUES ((title), (year), (runtime), (imdbID), (imdbRating))]
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbI
    D': 'imdbID', 'imdbRating:': 'imdbRating\n'}]
    (Background on this error at: http://sqlalche.me/e/f405<https://urldefense.proofpoint.com/v2/url?u=http-3A__sqlalche.me_e_f405&d=DwQFaQ&c=6zpojTjipf-nAlEmob0p1NKp0XhcK4Iau5zCDf5n3i4&r=EkFBsvaPSUevZPDtQjAAAQ&m=Xot5TRIVh5uMGwffElggSVh_Py_WMSNmnH5Kwtqqoi4&s=GttWMHmYIaInZ_L-jMF-E90rruf2yg1lhBuOMuJ8rj4&e=>)
    Thanks,
    Cravan
    From: "Gubba, Aruna" <AGubba@eprod.com<mailto:AGubba@eprod.com>>
    Date: Wednesday, 12 June 2019 at 9:10 PM
    To: cool kid <savageapple850@gmail.com<mailto:savageapple850@gmail.com>>, Adarsh Jaiswal <adarshjaiswal1989@gmail.com<mailto:adarshjaiswal1989@gmail.com>>
    Cc: "pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>" <pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>>
    Subject: RE: Error when doing sql
    
    Cravan,
    Postgres is case-sensitive, and the columns names in your insert statement should exactly match the table definition.
    Your insert into statement should look like this, (surround the exact column name around double quotes)
    Insert into movies(“Title”,”Year”, “Runtime”,”imdbID”, “imdbRating”)
    
    Thank you,
    
    Aruna Gubba
    
    From: Cravan <savageapple850@gmail.com<mailto:savageapple850@gmail.com>>
    Sent: Wednesday, June 12, 2019 8:07 AM
    To: Adarsh Jaiswal <adarshjaiswal1989@gmail.com<mailto:adarshjaiswal1989@gmail.com>>
    Cc: pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
    Hi, here is the table:[cid:image001.png@01D520F6.532A9180]
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com<mailto:adarshjaiswal1989@gmail.com>>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <savageapple850@gmail.com<mailto:savageapple850@gmail.com>>
    Cc: "pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>" <pgsql-novice@postgresql.org<mailto:pgsql-novice@postgresql.org>>
    Subject: Re: Error when doing sql
    
    \d+ tablename
    
    ________________________________
    
    This message (including any attachments) is confidential and intended for a specific individual and purpose. If you are not the intended recipient, please notify the sender immediately and delete this message.
    
  11. Re: Error when doing sql

    Cravan <savageapple850@gmail.com> — 2019-06-12T13:27:04Z

    Dear Aruna,
    
                    Thank you for your help anyway 😝
    
    Cravan
    
     
    
    From: "Gubba, Aruna" <AGubba@eprod.com>
    Date: Wednesday, 12 June 2019 at 9:25 PM
    To: cool kid <savageapple850@gmail.com>, Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: RE: Error when doing sql
    
     
    
    Cravan,
    
    I am not new to SQL, but new to Postgres and python scripting. I suspect somewhere in your python script there is still a reference to “title” instead “Title”, and you might want to search for that. I have been working with PgAdmin, but not worked with psql or python yet.
    
    Hope someone can help you troubleshoot the problem. 
    
     
    
    Thank you,
    
     
    
    Aruna Gubba
    
     
    
    From: Cravan <savageapple850@gmail.com> 
    Sent: Wednesday, June 12, 2019 8:15 AM
    To: Gubba, Aruna <AGubba@eprod.com>; Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
     
    
    Hi Aruna,
    
                    I have done what you suggested, and got a similar error with a “hint” this time
    
    ###############################
    
    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: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
    
                                                                 ^
    
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
     
    
     
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
    
      File "import.py", line 22, in <module>
    
        main()
    
      File "import.py", line 18, in main
    
        {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "im
    
    dbRating:": imdbRating }) # substitute values from CSV line into SQL command
    
    , as per this dict
    
      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 "t
    
    itle" does not exist
    
    LINE 1: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
    
                                                                 ^
    
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
     
    
    [SQL: INSERT INTO movies("Title", "Year", "Runtime", "imdbID", "imdbRating")
    
    VALUES ((title), (year), (runtime), (imdbID), (imdbRating))]
    
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbI
    
    D': 'imdbID', 'imdbRating:': 'imdbRating\n'}]
    
    (Background on this error at: http://sqlalche.me/e/f405)
    
    Thanks,
    
    Cravan
    
    From: "Gubba, Aruna" <AGubba@eprod.com>
    Date: Wednesday, 12 June 2019 at 9:10 PM
    To: cool kid <savageapple850@gmail.com>, Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: RE: Error when doing sql
    
     
    
    Cravan,
    
    Postgres is case-sensitive, and the columns names in your insert statement should exactly match the table definition.
    
    Your insert into statement should look like this, (surround the exact column name around double quotes)
    
    Insert into movies(“Title”,”Year”, “Runtime”,”imdbID”, “imdbRating”)
    
     
    
    Thank you,
    
     
    
    Aruna Gubba
    
     
    
    From: Cravan <savageapple850@gmail.com> 
    Sent: Wednesday, June 12, 2019 8:07 AM
    To: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
     
    
    Hi, here is the table:
    
     
    
    From: Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <savageapple850@gmail.com>
    Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
    
     
    
    \d+ tablename
    
     
    
    
    This message (including any attachments) is confidential and intended for a specific individual and purpose. If you are not the intended recipient, please notify the sender immediately and delete this message.
    
    
  12. RE: Error when doing sql

    David Raymond <david.raymond@tomtom.com> — 2019-06-12T14:44:09Z

    I _think_ your problem is now a Python problem where you're not correctly telling the execute method to bind the parameters.
    
    Your statement has INSERT INTO movies("Title", ..... VALUES ((title), (year), (runtime), (imdbID), (imdbRating))
    and then you give it the dictionary of values. But what method does sqlachemy use to specify what is supposed to receive a bound parameter? I know using psycopg2 for example you'd do ... values (%s, %s, %s...) to specify where the values you provide get bound.
    
    So I think it's not doing any binding, but literally just passing in the sql as-given, which is why "values ((title)..." has a problem, because it didn't get replaced by the Python library, and Postgres now thinks it's a column name.
    
    
    For the capitalization, Postgres is case-specific, but anything not in quotes gets turned into lowercase by the server before it gets run. (Someone will correct me if I'm not quite right here)
    
    So "create table FOO...;" becomes "create table foo...;" before it gets run by the server.
    
    "SELECT * FrOm fOO;" gets turned into "select * from foo;" by the server before it gets run, which matches the lowercase foo that got created.
    
    So as long as table names are lowercase then it's "effectively case-insensitive" because you can tell it foo or Foo or FOO and it'll wind up matching.
    
    Some programs (like pgAdmin I've seen) don't just take your table name and send it unquoted when doing a create table via the GUI. They go "ohh, you said you wanted Foo, so I'll quote it for you as "Foo" so it keeps the capital". While this is sort of helpful, it winds up destroying the "effectively case-insensitive" nature of the lower-casing system, and leaves you forever needing to put things in quotes and making sure you have the right casing.
    
    This is why you get things like "I told it to create Foo, I see Foo in the table list, but select from Foo says there's no table with that name? What?"
    
    (Hopefully this wasn't too confusing)
    
    
    From: Cravan <savageapple850@gmail.com> 
    Sent: Wednesday, June 12, 2019 9:15 AM
    To: Gubba, Aruna <AGubba@eprod.com>; Adarsh Jaiswal <adarshjaiswal1989@gmail.com>
    Cc: pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
    
    Hi Aruna,
                    I have done what you suggested, and got a similar error with a “hint” this time
    ###############################
    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: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
                                                                 ^
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
    
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
      File "import.py", line 22, in <module>
        main()
      File "import.py", line 18, in main
        {"title": title, "year": year, "runtime": runtime, "imdbID": imdbID, "im
    dbRating:": imdbRating }) # substitute values from CSV line into SQL command
    , as per this dict
      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 "t
    itle" does not exist
    LINE 1: ...ear", "Runtime", "imdbID", "imdbRating") VALUES ((title), (y...
                                                                 ^
    HINT:  Perhaps you meant to reference the column "movies.Title".
    
    [SQL: INSERT INTO movies("Title", "Year", "Runtime", "imdbID", "imdbRating")
    VALUES ((title), (year), (runtime), (imdbID), (imdbRating))]
    [parameters: {'title': 'Title', 'year': 'Year', 'runtime': 'Runtime', 'imdbI
    D': 'imdbID', 'imdbRating:': 'imdbRating\n'}]
    (Background on this error at: http://sqlalche.me/e/f405)
    Thanks,
    Cravan
    From: "Gubba, Aruna" <mailto:AGubba@eprod.com>
    Date: Wednesday, 12 June 2019 at 9:10 PM
    To: cool kid <mailto:savageapple850@gmail.com>, Adarsh Jaiswal <mailto:adarshjaiswal1989@gmail.com>
    Cc: "mailto:pgsql-novice@postgresql.org" <mailto:pgsql-novice@postgresql.org>
    Subject: RE: Error when doing sql
    
    Cravan,
    Postgres is case-sensitive, and the columns names in your insert statement should exactly match the table definition.
    Your insert into statement should look like this, (surround the exact column name around double quotes)
    Insert into movies(“Title”,”Year”, “Runtime”,”imdbID”, “imdbRating”)
     
    Thank you,
     
    Aruna Gubba
     
    From: Cravan <mailto:savageapple850@gmail.com> 
    Sent: Wednesday, June 12, 2019 8:07 AM
    To: Adarsh Jaiswal <mailto:adarshjaiswal1989@gmail.com>
    Cc: mailto:pgsql-novice@postgresql.org
    Subject: Re: Error when doing sql
     
    Hi, here is the table:
     
    From: Adarsh Jaiswal <mailto:adarshjaiswal1989@gmail.com>
    Date: Wednesday, 12 June 2019 at 8:36 PM
    To: cool kid <mailto:savageapple850@gmail.com>
    Cc: "mailto:pgsql-novice@postgresql.org" <mailto:pgsql-novice@postgresql.org>
    Subject: Re: Error when doing sql
     
    \d+ tablename
    
    ________________________________________
    
    This message (including any attachments) is confidential and intended for a specific individual and purpose. If you are not the intended recipient, please notify the sender immediately and delete this message.