yhat / pandasql

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

'str' object has no attribute '_execute_on_connection' #102

Open posidonius opened 1 year ago

posidonius commented 1 year ago

A few days ago I started getting these error messages when trying to run sqldf :

AttributeError: 'str' object has no attribute '_execute_on_connection'

sqlalchemy.exc.ObjectNotExecutableError: Not an executable object

The error message prints out the query string I'm trying to use. It doesn't want to execute the query because it's a string, but that's how I've been using sqldf now for over a year.

There's nothing wrong with the query itself. And I didn't change any code as far as I know, so I'm not sure why this broke.

I tried upgrading some packages and that didn't help. Versions installed:

Python 3.10.9
pandasql==0.7.3
 - pandas [required: Any, installed: 1.5.3]
 - sqlalchemy [required: Any, installed: 2.0.0]
hrshdhgd commented 1 year ago

I experienced this too! (python 3.9)

As a temporary fix, I downgraded SQLAlchemy to a prior version (1.4.46) and everything worked gain.

posidonius commented 1 year ago

As a temporary fix, I downgraded SQLAlchemy to a prior version (1.4.46) and everything worked gain.

Thanks for your help; that restores functionality. Does this problem eventually get solved with a patch of pandasql?

hrshdhgd commented 1 year ago

That's my assumption. Depends on the authors of the project.

posidonius commented 1 year ago

There hasn't been a commit since 2017 so what's the likelihood of that?

hrshdhgd commented 1 year ago

Unfortunately, I'd say bleak. unless there is a PR from a non contributor.

posidonius commented 1 year ago

There's PR #100 from contributor minikill so hopefully there's someone here to merge it.

cmungall commented 1 year ago

That PR doesn't actually fix the issue it just forces use of 1.x

hrshdhgd commented 1 year ago

If you want to use SQLAlchemy v2.x, I think merging my PR will resolve this and 2 other issues.