Skip to content
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

Greed does not support SQLAlchemy 2.0 #201

Open
Steffo99 opened this issue Feb 6, 2023 Discussed in #200 · 7 comments
Open

Greed does not support SQLAlchemy 2.0 #201

Steffo99 opened this issue Feb 6, 2023 Discussed in #200 · 7 comments
Labels
bug Something that doesn't work as expected. bug-unknown I couldn't reproduce this bug.

Comments

@Steffo99
Copy link
Owner

Steffo99 commented Feb 6, 2023

Discussed in #200

Originally posted by Daria69lev February 5, 2023
ubuntu@ip-172-31-59-66:~/bot/greed$ python3 worker.py
Traceback (most recent call last):
File "/home/ubuntu/bot/greed/worker.py", line 17, in
import database as db
File "/home/ubuntu/bot/greed/database.py", line 225, in
class Order(TableDeclarativeBase):
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_api.py", line 199, in init
as_declarative(reg, cls, dict)
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 247, in _as_declarative
return MapperConfig.setup_mapping(registry, cls, dict, None, {})
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 328, in setup_mapping
return _ClassScanMapperConfig(
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 559, in init
self._scan_attributes()
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 1001, in _scan_attributes
collected_annotation = self._collect_annotation(
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/decl_base.py", line 1151, in _collect_annotation
extracted = _extract_mapped_subtype(
File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/orm/util.py", line 2306, in _extract_mapped_subtype
raise sa_exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Type annotation for "Order.items" can't be correctly interpreted for Annotated Declarative Table form. ORM annotations should normally make use of the Mapped[] generic type, or other ORM-compatible generic type, as a container for the actual type, which indicates the intent that the attribute is mapped. Class variables that are not intended to be mapped by the ORM should use ClassVar[]. To allow Annotated Declarative to disregard legacy annotations which don't use Mapped[] to pass, set "allow_unmapped = True" on the class or a superclass this class. (Background on this error at: https://sqlalche.me/e/20/zlpr)

@Steffo99 Steffo99 added the bug Something that doesn't work as expected. label Feb 6, 2023
@Steffo99
Copy link
Owner Author

Steffo99 commented Feb 6, 2023

This should not be happening, unless you are using SQLAlchemy 2.0 instead of the pinned 1.4 version.

Please attach the output of pip freeze in a comment, so I can better diagnose the issue!

@Steffo99
Copy link
Owner Author

Steffo99 commented Feb 6, 2023

(Ping for @Daria69lev, in case the issue conversion did not send a notification.)

@Daria69lev
Copy link

ubuntu@ip-172-31-59-66:~/bot/greed$ python3 -OO core.py
Traceback (most recent call last):
File "/home/ubuntu/bot/greed/core.py", line 241, in
main()
File "/home/ubuntu/bot/greed/core.py", line 97, in main
bot = duckbot.factory(user_cfg)(request=telegram.utils.request.Request(user_cfg["Telegram"]["con_pool_size"]))
AttributeError: module 'telegram' has no attribute 'utils'. Did you mean: '_utils'?

@Daria69lev
Copy link

new issue

@Steffo99
Copy link
Owner Author

Steffo99 commented Feb 7, 2023

AttributeError: module 'telegram' has no attribute 'utils'. Did you mean: '_utils'?

I'm not sure of what you're doing with your Python installation.

Try installing in a new venv!

@Steffo99 Steffo99 added the bug-unknown I couldn't reproduce this bug. label Feb 7, 2023
@laskriabdellah

This comment was marked as off-topic.

@Steffo99

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that doesn't work as expected. bug-unknown I couldn't reproduce this bug.
Projects
None yet
Development

No branches or pull requests

3 participants