-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from sqlalchemy import create_engine
import error
#6069
Comments
hi i need the exact Python interpreter version you are using |
also a reproduction case please |
sorry. |
this might be a python versioning issue. any chance you can try a newer python 2.7? I have 2.7.18 here, for example. |
Hi @zzzeek
|
you have a different problem. you seem to be using this package which is apparently not working for SQLAlchemy 1.4 . I would report this on their issue tracker at https://github.com/encode/databases . |
@zzzeek Thank you for reply, solved my problem 👍 |
From what I can see, the issue indeed only occurs with older py2.7 version. I tested with 1.4.0 and 1.4.1, same result. Ex: Using Python 2.7.18:
Now using Python 2.7.8 (the version on which the issue occured for me):
|
I felt like I had seen a similar thing before causing issue with older py2.7.x versions, and that was in another project I was depending on. I found it, and maybe this'll help fixing the issue (I'm really not sure I get what's going exactly to be able to tell if the fix idea really applies here though, sorry if it doesn't). https://github.com/pallets/werkzeug/pull/1545/files |
yes there is mention of this issue also at plone/plone.protect#74 and https://bugs.python.org/issue21591 . SQLAlchemy 1.4 was almost going to be Python 3 only, and the area in which this is occurring is a deep little spot where we are rewriting code objects, so I'm not sure what adjustment would fix it, if any, or maybe it's not that hard, but overall, if you look at places lke https://pypistats.org/packages/sqlalchemy we can see that Python 2 use / downloads are vastly less frequent than Python 3 downloads (in the 30K range, which is not nothing, but a lot less), this looks like a "wontfix" and at most we'd note it in the documentation. if you have an environment running on python < 2.7.9 or so, and newer Python 2.7s at least are not an option, that's an old environment, like an old Centos or whatever it is, it's to be expected that other packages need to stay on their older versions as well; it's not an env where new development should be occurring. |
that actually looks like a really simple fix in fact, I thought the issue was how we were rewrting the code itself. if that's the case then there would be a bit of a path to doing this. but python 2.7.9 is really old. lots of packages are python 3 only now even. |
I'd like to add that I see this issue on our build server (CentOS 7) that is still using Python 2.7.5. As far as I can tell, the underlying issue is this: https://bugs.python.org/issue21591 and in my tests it was easily fixed by by replacing the exec() in https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/sql/lambdas.py#L1067 with I appreciate that python2 support is on the verge of being removed, but then again this is a simple fix and I would much rather migrate to sqlalchemy 1.4 first with py2 while I'm tackling the changes for python3 |
if it's not hard to fix then someone can please send us a PR and we can have that right in for 1.4.3. thanks! |
Martin Häcker has proposed a fix for this issue in the master branch: Fixes #6069 https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2664 |
wow great catch, we already had exec_() to do this, very nice. I am not too concerned about testing if folks with old Python 2.7's can confirm it works that's good enough for me. |
when I first saw this error I was concerned it was more about the specific manipulations I'm doing with the code objects. |
No, AFAIK it's really all about statement based A test run on my build server with this change using
Not quite sure what to make of these, as they seem unrelated? Locally with python 2.7.16 these tests pass (with the same change). |
What kind of test run do you require to check that these changes are working? |
a few of those errors look like a very old bundled version of sqlite which would be expected on a very old Python version. the "dictionary sized" errors look much more concerning and are likely more bugs in some combination of SQLAlhcemy and/or very old Python versions but are likely not related to this exec change. the change passed on CI which includes Python 2.7 so this should get a changelog file and be merged for the next release. |
Martin Häcker has proposed a fix for this issue in the master branch: Use compat.exec_() https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2664 |
glad we could figure this out thanks all for the help! |
Describe the bug
Getting the following when importing 1.4.0 sqlalchemy's create_engine method:
The text was updated successfully, but these errors were encountered: