def get_all(cls): with (yield from notorm.db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)) as cursor: yield from cursor.execute("""select game.*::game from game order by name""", {}) results = yield from cursor.fetchall() games = notorm.build_relationships(results, "game") return games
def get_all(cls): cursor = notorm.db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor) cursor.execute("""select game.*::game from game order by name""") results = cursor.fetchall() games = notorm.build_relationships(results, 'game') return games
def get(cls, game_id): with (yield from notorm.db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)) as cursor: yield from cursor.execute("""select game.*::game from game where id = %(game_id)s""", {"game_id": game_id}) results = yield from cursor.fetchall() games = notorm.build_relationships(results, "game") if not games: return None return games[0]
def get(cls, game_id): cursor = notorm.db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor) cursor.execute("""select game.*::game from game where id = %(game_id)s""", {'game_id': game_id}) results = cursor.fetchall() games = notorm.build_relationships(results, 'game') if not games: return None return games[0]