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

Added base usage example for aiohttp server #231

Merged
merged 2 commits into from
May 5, 2024
Merged

Conversation

rudyryk
Copy link
Member

@rudyryk rudyryk commented May 4, 2024

Simple example of usage with aiohttp server with GET and POST requests.

Btw, Manager.update() seems to be broken. I'd want to restore it first and then go with smooth deprecation process if (really) necessary. Hopefully I'll be able to prepare the next pull request soon.

Hi @kalombos :) Thank you for being such an active contributor and maintaner! Please take a look at this PR.

@rudyryk rudyryk requested a review from kalombos May 4, 2024 15:22
@kalombos
Copy link
Collaborator

kalombos commented May 4, 2024

Hi @rudyryk Glad to see you :) I totally agree there should be smooth deprecation process but are you sure Manager.update() is broken? Because the tests have passed and i did not change this part of code.

In our projects we created BaseModel classes similiar to AioModel It's more convinient to use such class instead of the Manager. So i decided to create AioModel class with async versions of peewee.Model methods. These methods should have the same name like in peewee with prefix aio and provide the same functionality. When the AioModel class is ready, the Manager class will just repeat its functionality. All Manager methods will be proxy-methods like this one. That's why i decided to make it deprecated. The only unique functionality the Manager has is database swap. I don't know how to use it :) And i thought it is for very rare cases so i decided to remove it in the future.

I will review your PR in a couple of days

@rudyryk
Copy link
Member Author

rudyryk commented May 4, 2024

but are you sure Manager.update() is broken?

It's not completely broken but now it requires models to be subclassed from AioMode. Actually the original intention of having the Manager was the ability to work without changing models hierarchy.

But I guess no big problem here, I've almost prepared a new PR with compatibility module extracted + tests.

@rudyryk
Copy link
Member Author

rudyryk commented May 4, 2024

Manager extracted to compatibility module in PR #232

@rudyryk rudyryk self-assigned this May 4, 2024
examples/aiohttp_example.py Show resolved Hide resolved
examples/docker-compose.yaml Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
examples/requirements.txt Outdated Show resolved Hide resolved
examples/aiohttp_example.py Outdated Show resolved Hide resolved
@rudyryk rudyryk merged commit 430a3cf into master May 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants