
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Asynchronous interface for peewee ORM powered by asyncio.
The complete documentation:
http://peewee-async-lib.readthedocs.io
Install with pip
for PostgreSQL aiopg backend:
pip install peewee-async[postgresql]
or for PostgreSQL psycopg3 backend:
pip install peewee-async[psycopg]
or for MySQL:
pip install peewee-async[mysql]
Create 'test' PostgreSQL database for running this snippet:
createdb -E utf-8 test
import asyncio
import peewee
import peewee_async
# Nothing special, just define model and database:
database = peewee_async.PooledPostgresqlDatabase(
database='db_name',
user='user',
host='127.0.0.1',
port='5432',
password='password',
)
class TestModel(peewee_async.AioModel):
text = peewee.CharField()
class Meta:
database = database
# Look, sync code is working!
TestModel.create_table(True)
TestModel.create(text="Yo, I can do it sync!")
database.close()
# No need for sync anymore!
database.set_allow_sync(False)
async def handler():
await TestModel.aio_create(text="Not bad. Watch this, I'm async!")
all_objects = await TestModel.select().aio_execute()
for obj in all_objects:
print(obj.text)
loop = asyncio.get_event_loop()
loop.run_until_complete(handler())
loop.close()
# Clean up, can do it sync again:
with database.allow_sync():
TestModel.drop_table(True)
# Expected output:
# Yo, I can do it sync!
# Not bad. Watch this, I'm async!
Check the ./examples
directory for more.
http://peewee-async-lib.readthedocs.io
http://peewee-async.readthedocs.io - DEPRECATED
Install dependencies using pip:
pip install -e .[develop]
Or using poetry:
poetry install -E develop
Run databases:
docker-compose up -d
Run tests:
pytest tests -v -s
You are welcome to add discussion topics or bug reports to tracker on GitHub: https://github.com/05bit/peewee-async/issues
Copyright (c) 2014, Alexey Kinev rudy@05bit.com
Licensed under The MIT License (MIT), see LICENSE file for more details.
FAQs
Asynchronous interface for peewee ORM powered by asyncio.
We found that peewee-async demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.