title: ProgrammingError: (psycopg2.errors.UndefinedColumn), while working with sqlalchemy
body: <p>I have trouble querying a table, created with sqlalchemy on postgres db (local).</p>
  
  <p>While I am able to execute, and receive query result with: </p>
  
  <pre><code>SELECT * FROM olympic_games 
  </code></pre>
  
  <p>I am getting an error message when I'm trying to access single column, or perform any other operation on table:</p>
  
  <pre><code>SELECT games FROM olympic_games
  </code></pre>
  
  <p>The error message is (couple sentences translated from Polish): </p>
  
  <blockquote>
    <p>ProgrammingError: (psycopg2.errors.UndefinedColumn) BŁĄD: column "games" does not exist</p>
    
    <p>LINE 1: SELECT COUNT(Sport)<br>
                            ^<br>
    HINT:  maybe you meant "olympic_games.Games".  </p>
    
    <p>SQL: SELECT games FROM olympic_games LIMIT 5;]<br>
    (Background on this error at: <a href="http://sqlalche.me/e/f405" rel="nofollow noreferrer">http://sqlalche.me/e/f405</a>)</p>
  </blockquote>
  
  <p>It pretty much sums to that program doesn't see, or can access specific column, and display that it doesn't exist.</p>
  
  <p>I tried accessing with <code>table.column</code> format, it didn't work as well. I am also able to see column names, via <code>information_schema.columns</code> </p>
  
  <p>Data (.csv) was loaded with <code>pd.read_csv</code>, and then <code>DataFrame.to_sql</code>. Code below, thanks for help!</p>
  
  <pre><code>engine = create_engine('postgresql://:@:/olympic_games')
  
  with open('olympic_athletes_2016_14.csv', 'r') as file:
      df = pd.read_csv(file, index_col='ID')
  df.to_sql(name = 'olympic_games', con = engine, if_exists = 'replace', index_label = 'ID')
  </code></pre>
  
  <p>Both execute commands returned with same error: </p>
  
  <pre><code>with engine.connect() as con:
      rs = con.execute("SELECT games FROM olympic_games LIMIT 5;")
      df_fetch = pd.DataFrame(rs.fetchall())
  </code></pre>
  
  <pre><code>df_fetch2 = engine.execute("""SELECT games FROM olympic_games LIMIT 5;""").fetchall()
  </code></pre>