简体   繁体   中英

Non-blocking ORM for Tornado?

Is there any asynchronous Python ORM other than Twistar ?

I'm looking for lightweight ORM for non-blocking API, built on top of tornado. Of course, I can write raw SQL queries using momoko, but I'd like to work with objects.

Sure, it is! Look at peewee and peewee-async extension. Disclaimer: extension is only for PostgreSQL at the moment and I'm an author of extension :)

It's not specifically for Tornado, but Tornado can run on asyncio event loop.

It's been 5 years, and a lot changed. We wrote GINO to be a lightweight ORM on top of asyncpg and SQLAlchemy core . It is for asyncio and PostgreSQL only. GINO as "GINO Is Not ORM", because it applied almost none usual ORM patterns, in order to be explicit and simple.

None exist. The only ORM that could even consider coming close to being lightweight is PeeWee , and that isn't async. ORMs are hard to write, and even harder to write well . It needs to have a nice, clean API, expose many features of the underlying DB, and be efficient. A tall order!

There aren't many ORMs for Python, and even fewer async ones. Sorry.

Have a look at Tortoise ORM

Its aiming to be a full-featured ORM inspired by Django syntax , but asycnio only. Since Tornado 5.0 runs on asyncio, it should just work.

If using mongo you can look into Asyncmongo (not an orm but let's you access your data Async) https://github.com/bitly/asyncmongo

if it is of interest see video and slides from this webminar: "Asynchronous MongoDB with Python and Tornado" http://www.10gen.com/presentations/webinar/Asynchronous-MongoDB-with-Python-and-Tornado

你可能想看看Monguo ,一个“全功能,异步MongoDB ORM与Tornado应用程序的电机驱动程序”,因为它描述了自己。

You may want to have a look at umysqldb( https://github.com/hongqn/umysqldb ), A MySQLdb compatible wrapper around ultramysql. ultramysql compatible with gevent through monkey patching.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM