-2

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?

0

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.