Back to top

ReQL command: set_loop_type

Command syntax

r.set_loop_type(string)

Description

Set an asynchronous event loop model. There are two supported models:

Example: Read a table’s data using Tornado.

r.set_loop_type("tornado")
conn = r.connect(host='localhost', port=28015)

@gen.coroutine
def use_cursor(conn):
    # Print every row in the table.
    cursor = yield r.table('test').order_by(index="id").run(yield conn)
    while (yield cursor.fetch_next()):
        item = yield cursor.next()
        print(item)

For a longer discussion with both Tornado and Twisted examples, see the documentation article on Asynchronous connections.

Get more help

Couldn't find what you were looking for?