Trying to import a table from a SQLite into Pandas DF:
import pandas as pd
import sqlite3
cnxn = sqlite3.Connection("my_db.db")
c = cnxn.cursor()
Using this command works: pd.read_sql_query('select * from table1', con=cnxn)
. This doesn't : df = pd.read_sql_table('table1', con=cnxn)
.
Response :
ValueError: Table table1 not found
What could be the issue?
CodePudding user response:
Using SQLite in Python the pd.read_sql_table()
is not possible. Info found in Pandas doc.
Hence it's considered to be a DB-API when running the commands thru Python.
pd.read_sql_table() Documentation
Given a table name and a SQLAlchemy connectable, returns a DataFrame. This function does not support DBAPI connections.