Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 635
Nikolay Fominyh Avatar asked May 28 '12 11:05

Nikolay Fominyh


People also ask

Does tornado use Asyncio?

The Tornado Web Framework Since it uses asyncio, with Tornado you can create a node. js-like web server that runs asynchronously, thus able to handle many more requests than if it were running synchronously.

Is tornado multithreaded?

To minimize the cost of concurrent connections, Tornado uses a single-threaded event loop. This means that all application code should aim to be asynchronous and non-blocking because only one operation can be active at a time.

Is Async a tornado?

Tornado is a Python web framework and asynchronous network library, originally developed at FriendFreed. Tornado uses non-blocking network-io. Due to this, it can handle thousands of active server connections.

Is asynchronous and non-blocking same?

Non-Blocking methods are executed asynchronously. Asynchronously means that the program may not necessarily execute line by line. The program calls the function and move to the next operation and does not wait for it to return.


2 Answers

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.

like image 138
rudyryk Avatar answered Nov 14 '22 20:11

rudyryk


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.

like image 5
Fantix King Avatar answered Nov 14 '22 20:11

Fantix King