-
-
Notifications
You must be signed in to change notification settings - Fork 769
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
Update sqlalchemy example to work with Python 3.8, 3.9 and 3.10 #2025
base: main
Are you sure you want to change the base?
Conversation
When trying to work with this example I received the error: ```bash AttributeError: module 'datetime' has no attribute 'UTC' ``` Doing some research, it seems the new pattern is to pull UTC from timezone. Making the suggested edit as a PR
Thanks for using my example! What version of Python are you using to run it? I'm using Python 3.13 and when I clone your repo, checkout your branch and run the example, I see this error:
In recent Python versions the Still you have definitely caught something that blocks running the example in old(er) versions of Python. I recommend updating your PR to have the following code that works for me and also, I think, sorts the imports in the order that
|
Updating the import orders and the datetime usage to follow a pattern that works with 3.9.7 and 3.13
Good catch! Appreciate the python links. I was on Python 3.9.7 for my run of the example, an old(er) Python version that is not current. I updated the commit to match your diff for the PR. |
I finally learned how to supply the appropriate arguments to
I created a Python 3.9 venv to run your code, but the example still fails with the same error as before. Does this work for you?
Here's a diff that makes everything work:
|
Appreciate the diffs! I did a test with the lowercase |
Cool. You might want to update the first line of the commit message to be a bit more descriptive, I recommend something like this:
|
+1 from me - but I'm not a maintainer so it doesn't really count lol |
When trying to work with this example I received the error:
Doing some research, it seems the new pattern is to pull UTC from timezone. Making the suggested edit as a PR
Fixes # .
Changes proposed in this pull request: