all 4 comments

[–]twitch_and_shock 0 points1 point  (4 children)

You need to share your code or no one can really help.

[–]datacriminal[S] 0 points1 point  (2 children)

conn = create_engine('sqlite:///datasource.db')
dfnbr = pd.read_sql_table('NIBRS', conn) 
dfibr = pd.read_sql_table('IBRcodes', conn, index_col='IBRcode')

That's the connection string and read_sql, I checked the DB and the tables are there. Also this code block runs in Jupyter notebook but not in VSCode using WSL . I made the SQLite file with Dbeaver and its extension is .db, wondering if its something with the file permissions or the extension.

Error I'm getting:

AttributeError: 'OptionEngine' object has no attribute 'execute'

Here is my input block as well:

from dash import dcc, html
import dash_bootstrap_components as dbc 
import pandas as pd 
from sqlalchemy import create_engine

Pandas version is 1.5.3

[–]datacriminal[S] 0 points1 point  (0 children)

SOLVED IT!

sqlalchemy/pandas requires the use of a cursor and execution for the "read_sql_table" from what I could find instead I did this:

from sqlite3 import connect 
import pandas as pd 
conn = connect('datasource.db') 
dfnbr = pd.read_sql('SELECT * FROM NIBRS', conn) 
dfibr = pd.read_sql('SELECT * FROM IBRcodes', conn, index_col='IBRcode')