kszucs / aiopeewee Goto Github PK
View Code? Open in Web Editor NEWAsyncio interface for Peewee ORM
License: MIT License
Asyncio interface for Peewee ORM
License: MIT License
Due to the use of connection pool by default, the async with self.pool.acquire()
idiom is required in most of the database methods. The async with hell gets complicated in the case of atomic operations. The with db.atomic()
idiom requires the connection to be shipped downward resulting a deeply nested async context manager, which should look like a single one (from the API perspective). The original peewee implementation uses deque and heap structures to handle the nesting within a single thread.
The most painful parts are here:
async with self.get_conn()
)I could use a more asyncio experienced point of view here :)
Could someone give me a hand / guidance?
hi, when i run sanic aiopeewee example, I get
Traceback (most recent call last):
File "/Users/name/PycharmProjects/sanic-demo/sanic_aiopeewee.py", line 4, in <module>
from aiopeewee import AioModel, AioMySQLDatabase, model_to_dict
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiopeewee/__init__.py", line 1, in <module>
from .model import AioModel
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiopeewee/model.py", line 3, in <module>
from .query import (AioSelectQuery, AioUpdateQuery, AioInsertQuery,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiopeewee/query.py", line 2, in <module>
from peewee import SQL, Query, RawQuery, SelectQuery, NoopSelectQuery
ImportError: cannot import name 'NoopSelectQuery'
What happen?
Modules is installed
Please declare it in setup.py
Peewee released version 3.0. It would be awesome if aiopeewee supports it.
Drone is not available anymore, and the lack of public CI blocks merging PRs.
When result of a query is empty StopAsyncIteration is raised.
That's why get_or_create doesn't work properly because it wants to catch DoesNotExist exception.
File "/Users/rara/.pyenv/versions/miniconda3-latest/envs/papi-conda/lib/python3.6/site-packages/sanic/app.py", line 471, in handle_request
response = await response
File "/Users/rara/git/papi/papi/access.py", line 13, in wrapper
response = await f(request, *args, **kwargs)
File "/Users/rara/git/papi/papi/account.py", line 18, in list_accounts
return await to_json(accounts, max_depth=0)
File "/Users/rara/git/papi/papi/utils.py", line 36, in to_json
return json(await to_native(record, **kwargs))
File "/Users/rara/git/papi/papi/models.py", line 190, in to_native
return await model_to_dict(record, **kwargs)
File "/Users/rara/.pyenv/versions/miniconda3-latest/envs/papi-conda/lib/python3.6/site-packages/aiopeewee/shortcuts.py", line 43, in model_to_dict
for field in model._meta.declared_fields:
AttributeError: 'AioNaiveQueryResultWrapper' object has no attribute '_meta'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.