All Projects → 05bit → Peewee Async

05bit / Peewee Async

Licence: mit
Asynchronous interface for peewee ORM powered by asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Peewee Async

Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+321.42%)
Mutual labels:  asyncio, orm, mysql, postgresql
Sqlsugar
Best ORM Fastest ORM Simple Easy Sqlite orm Oracle ORM Mysql Orm postgresql ORm SqlServer oRm 达梦 ORM 人大金仓 ORM 神通ORM C# ORM
Stars: ✭ 3,748 (+517.46%)
Mutual labels:  orm, mysql, postgresql
Doctrinejsonfunctions
Doctrine DQL functions for SQL JSON data type
Stars: ✭ 325 (-46.46%)
Mutual labels:  orm, mysql, postgresql
Denodb
MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Stars: ✭ 498 (-17.96%)
Mutual labels:  orm, mysql, postgresql
Node Orm2
Object Relational Mapping
Stars: ✭ 3,063 (+404.61%)
Mutual labels:  orm, mysql, postgresql
Jennifer.cr
Crystal ORM using ActiveRecord pattern with flexible query DSL
Stars: ✭ 309 (-49.09%)
Mutual labels:  orm, mysql, postgresql
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+640.86%)
Mutual labels:  orm, mysql, postgresql
Lithium
Easy to use C++17 HTTP Server with no compromise on performances. https://matt-42.github.io/lithium
Stars: ✭ 523 (-13.84%)
Mutual labels:  orm, mysql, postgresql
Openrecord
Make ORMs great again!
Stars: ✭ 474 (-21.91%)
Mutual labels:  orm, mysql, postgresql
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+673.48%)
Mutual labels:  orm, mysql, postgresql
Sqlc
Generate type-safe code from SQL
Stars: ✭ 4,564 (+651.89%)
Mutual labels:  orm, mysql, postgresql
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+4275.45%)
Mutual labels:  orm, mysql, postgresql
Piccolo
A fast, user friendly ORM and query builder which supports asyncio.
Stars: ✭ 219 (-63.92%)
Mutual labels:  asyncio, orm, postgresql
Rel
💎 Modern Database Access Layer for Golang - Testable, Extendable and Crafted Into a Clean and Elegant API
Stars: ✭ 317 (-47.78%)
Mutual labels:  orm, mysql, postgresql
Aioodbc
aioodbc - is a library for accessing a ODBC databases from the asyncio
Stars: ✭ 206 (-66.06%)
Mutual labels:  asyncio, mysql, postgresql
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (-36.74%)
Mutual labels:  orm, mysql, postgresql
Mikro Orm
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
Stars: ✭ 3,874 (+538.22%)
Mutual labels:  orm, mysql, postgresql
Xo
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server
Stars: ✭ 2,974 (+389.95%)
Mutual labels:  orm, mysql, postgresql
Antdata.orm
特色:vs插件或者t4一键生成entity 支持配置非物理外键。分离linq转sql引擎(原生linq非扩展)和执行dal功能,支持异步,支持netcore2.0
Stars: ✭ 428 (-29.49%)
Mutual labels:  orm, mysql, postgresql
Qb
The database toolkit for go
Stars: ✭ 524 (-13.67%)
Mutual labels:  orm, mysql, postgresql

peewee-async

Asynchronous interface for peewee ORM powered by asyncio.

Build Status PyPi Version Documentation Status

Important notes

  • Since version 0.6.0a only peewee 3.5+ is supported
  • If you still need Python 3.4 support use older versions, i.e. pip install peewee-async==0.5.12

Version 0.6.0a is published as pre-release, mind the "a" in version identifier. That means in order to install it you should specify --pre flag for pip.

Overview

  • Requires Python 3.5+
  • Has support for PostgreSQL via aiopg
  • Has support for MySQL via aiomysql
  • Single point for high-level async API
  • Drop-in replacement for sync code, sync will remain sync
  • Basic operations are supported
  • Transactions support is present, yet not heavily tested

The complete documentation:
http://peewee-async.readthedocs.io

Install

Install with pip for PostgreSQL:

pip install --pre peewee-async; pip install aiopg

or for MySQL:

pip install --pre peewee-async; pip install aiomysql

Quickstart

Create 'test' PostgreSQL database for running this snippet:

createdb -E utf-8 test

The code below is using new Python 3.5 async / await syntax, but older yield from will also work!

import asyncio
import peewee
import peewee_async

# Nothing special, just define model and database:

database = peewee_async.PostgresqlDatabase(
    database='db_name',
    user='user',
    host='127.0.0.1',
    port='5432',
    password='password'
)

class TestModel(peewee.Model):
    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()

# Create async models manager:

objects = peewee_async.Manager(database)

# No need for sync anymore!

database.set_allow_sync(False)

async def handler():
    await objects.create(TestModel, text="Not bad. Watch this, I'm async!")
    all_objects = await objects.execute(TestModel.select())
    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 objects.allow_sync():
    TestModel.drop_table(True)

# Expected output:
# Yo, I can do it sync!
# Not bad. Watch this, I'm async!

Documentation

http://peewee-async.readthedocs.io

Discuss

You are welcome to add discussion topics or bug reports to tracker on GitHub: https://github.com/05bit/peewee-async/issues

License

Copyright (c) 2014, Alexey Kinev [email protected]

Licensed under The MIT License (MIT), see LICENSE file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].