#Sql problems in python
27 messages · Page 1 of 1 (latest)
import pandas as pd
import pandasql as ps
sheet_id = "1ElftZLF_sJBl6UNldK9uLIIlQwxqAhHj1MyaD1A7Pt0"
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{sheet_id}/export?format=csv")
df = df.set_index("id")
sql_query = "SELECT * FROM df WHERE age < 15"
print(ps.sqldf(sql_query, globals()))
how can i make my id field strings?
this is so confusing
i dont get whats wrong
all i can really do is look at https://pypi.org/project/pandasql/
PandaSQL hasn't been updated in 7 years. Checking the GitHub there are 50 issues, in the last 3 months people have begun reporting that the package no longer works.
Do not use pandasql, it will only continue to break and will remain unsupported.
If you insist on using it, use pip to uninstall sqlalchemy and reinstall the 1.4 version with this command
pip install SQLAlchemy==1.4.46
It breaking coincides with the release of SQLAlchemy 2.0, so I'm guessing going back to 1.4 will fix it.
thanks do u reccomend a diff framework thats similar?
I don't use pandas so have no idea what's available.

