• This repository has been archived on 06/Nov/2019
  • Stars
    star
    611
  • Rank 70,874 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 13 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An asynchronous library for accessing mongo with tornado.ioloop

asyncmongo

AsyncMongo is an asynchronous library for accessing mongo which is built on the tornado ioloop.

Build Status

Installation

Installing: pip install asyncmongo

Usage

asyncmongo syntax strives to be similar to pymongo.

import asyncmongo
import tornado.web

class Handler(tornado.web.RequestHandler):
    @property
    def db(self):
        if not hasattr(self, '_db'):
            self._db = asyncmongo.Client(pool_id='mydb', host='127.0.0.1', port=27017, maxcached=10, maxconnections=50, dbname='test')
        return self._db

    @tornado.web.asynchronous
    def get(self):
        self.db.users.find({'username': self.current_user}, limit=1, callback=self._on_response)
        # or
        # conn = self.db.connection(collectionname="...", dbname="...")
        # conn.find(..., callback=self._on_response)

    def _on_response(self, response, error):
        if error:
            raise tornado.web.HTTPError(500)
        self.render('template', full_name=response['full_name'])

About

Some features are not currently implemented:

  • directly interfacing with indexes, dropping collections
  • retrieving results in batches instead of all at once (asyncmongo's nature means that no calls are blocking regardless of the number of results you are retrieving)
  • tailable cursors #15

Requirements

The following two python libraries are required

Issues

Please report any issues via github issues

More Repositories

1

oauth2_proxy

A reverse proxy that provides authentication with Google, Github or other provider
Go
5,103
star
2

go-simplejson

a Go package to interact with arbitrary JSON
Go
3,719
star
3

data_hacks

Command line utilities for data analysis
Python
1,937
star
4

dablooms

scaling, counting, bloom filter library
C
965
star
5

statsdaemon

an implementation of Etsy's statsd in Go
Go
570
star
6

simplehttp

a family of libraries and daemons for building scalable web infrastructure
C
538
star
7

go-hostpool

Intelligently and flexibly pool among multiple hosts from your Go application
Go
377
star
8

bitly-api-python

python library to the bitly api
Python
244
star
9

go-notify

a Go package to observe notable events in a decoupled fashion
Go
236
star
10

forgettable

Various implementations of the forget table: a distributional database that forgets data
Go
201
star
11

file2http

spray a line-oriented file at an HTTP endpoint
Go
84
star
12

pyqrencode

python bindings for libqrencode
C
67
star
13

asyncdynamo

async Amazon DynamoDB library for Tornado
Python
60
star
14

ngx_http_full_request_log

nginx module to log a full request
C
32
star
15

bitly_chrome_extension

bit.ly chrome extension
JavaScript
27
star
16

little_bigtable

Little Bigtable is an emulator for Google Bigtable w/ persistence in sqlite3
Go
21
star
17

timer_metrics

TimerMetrics captures timings and enables periodic metrics every n events
Go
15
star
18

assetman

Assetman burns countless cycles and makes your deploys take forever
Python
14
star
19

doozer-c

async C client library for doozerd
C
10
star
20

bitly_ios_sdk_release

Bitly SDK for iOS
7
star
21

tsplot

Go
1
star
22

sprinterns2022

Python
1
star
23

winterns2021

Python
1
star