yhat / pandasql

sqldf for pandas
MIT License
1.31k stars 184 forks source link

doesn't work in Flask #96

Open mpourvali opened 2 years ago

mpourvali commented 2 years ago

@app.route("/query", methods= ["GET", 'POST']) def query(): pysqldf = lambda q: sqldf(q, locals()) csv_data = pd.read_csv('./for_download/for_query.csv', index_col=[0]) query = "select * from csv_data" trows = pysqldf(query)

I can't get the table in this way, and face this error: pandasql.sqldf.PandaSQLException: (sqlite3.OperationalError) no such table: csv_data

mpourvali commented 2 years ago

it also doesn't work with globals()