0
import pandas as pd
import sqlite3
from pandas.io.sql import read_sql


conn = sqlite3.connect('my_database.db3')
data = read_sql('select * from my_table',conn)

The issue I am facing here is I can use this code in wing ide to read the table, while Anaconda spyder fails to execute the command:

the output error is :

DatabaseError: Execution failed on sql 'select * from my_table': no such table: my_table

Any ideas why?

EDIT:

run directly from sqlite3, giving following error:

  File "<ipython-input-186-71ea29127489>", line 7, in <module>
    data = conn.execute('select * from my_table;')

OperationalError: no such table: my_table
Makaroniiii
  • 348
  • 3
  • 16
  • If you use directly sqlite3, does it work ? If yes, post more info, if no, there it is. – baloo Jul 01 '17 at 13:51
  • Try checking if there indeed is `my_table` in your database by listing all table names: `res = conn.execute("SELECT name FROM sqlite_master WHERE type='table';")`. See [here](https://stackoverflow.com/questions/34570260/how-to-get-table-names-using-sqlite3-through-python) for more info. – Matt Jul 01 '17 at 14:29

0 Answers0