Skip to content

Instantly share code, notes, and snippets.

@skolsuper
skolsuper / queryset.py
Created May 26, 2016 04:26
ORM-style wrapper around rethinkdb driver
import logging
import operator
from typing import List, Any, Tuple, Mapping, Callable, Iterable
import rethinkdb as r
from resync.connection import DatabaseQuery, connection_pool, RethinkConnection
from resync.diff import get_diff_from_changeset, Diff, delete
l = logging.getLogger('resync.queryset')
@skolsuper
skolsuper / connection.py
Created May 24, 2016 02:46
Rudimentary connection pool for rethinkdb asyncio connections
from weakref import WeakSet
from asyncio import Queue, QueueEmpty
from logging import getLogger
from typing import Tuple
import rethinkdb as r
from rethinkdb.net import DefaultConnection
l = getLogger('rethinkdb.connection')