From f66fcacc2aaaa3adbc2f81d2ac740e112c496046 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 30 Oct 2015 14:12:47 +0100 Subject: Use psycopg's builtin support for jsonb columns --- db/models.py | 9 ++++----- readme.md | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/db/models.py b/db/models.py index f5c690d..23152c3 100644 --- a/db/models.py +++ b/db/models.py @@ -50,20 +50,19 @@ class Problem(collections.namedtuple('Problem', ['id', 'language', 'group', 'ide # known as Attempt in the original code class Solution(collections.namedtuple('Solution', ['id', 'done', 'content', 'problem_id', 'codeq_user_id', 'trace'])): - __sql_prefix = 'select id, done, content, problem_id, codeq_user_id, trace::text from solution' - __row_conversion = lambda row: (row[0], row[1], row[2], row[3], row[4], json.loads(row[5])) + __sql_prefix = 'select id, done, content, problem_id, codeq_user_id, trace from solution' @staticmethod def get(**kwargs): - return _general_get(kwargs, Solution, Solution.__sql_prefix, Solution.__row_conversion) + return _general_get(kwargs, Solution, Solution.__sql_prefix) @staticmethod def list(): - return _general_list(Solution, Solution.__sql_prefix, Solution.__row_conversion) + return _general_list(Solution, Solution.__sql_prefix) @staticmethod def filter(**kwargs): - return _general_filter(kwargs, Solution, Solution.__sql_prefix, Solution.__row_conversion) + return _general_filter(kwargs, Solution, Solution.__sql_prefix) def _no_row_conversion(row): diff --git a/readme.md b/readme.md index 8e5d200..d344e79 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,11 @@ Installation ============ +Minimum versions of required packages: + + - python3-psycopg2 ≥ 2.5.4 + - swi-prolog ≥ 7.3 + These instructions assume you are running Debian Jessie. Install dependencies: apt install apache2 nodejs npm python3 python3-ply python3-psycopg2 python3-termcolor -- cgit v1.2.1