예제 #1
0
파일: db.py 프로젝트: celaus/T-Mon
def execute(query, wsid, **options):
    """ Executes a query from utils.queries. """

    if isinstance(query, ViewDefinition):

        ws_name = get_webservice(wsid).name
        return query(connection.switch_db(ws_name), **options)
예제 #2
0
파일: db.py 프로젝트: celaus/T-Mon
def bulkinsert(documents, wsid):
    """ """

    if documents and wsid:
        ws_name = get_webservice(wsid).name
        database = connection.switch_db(ws_name)
        database.update(documents)
예제 #3
0
파일: db.py 프로젝트: celaus/T-Mon
def sync(query, wsid):
    """ Syncs the given utils.query query with the associated CouchDB. """

    if isinstance(query, ViewDefinition):
        ws_name = get_webservice(wsid).name
        query.sync(connection.switch_db(ws_name))
예제 #4
0
파일: db.py 프로젝트: celaus/T-Mon
def store(data, wsid):
    """ Writes the given data to the associated CouchDB. """

    if data:
        ws_name = get_webservice(wsid).name
        data.store(connection.switch_db(ws_name))