def parse_query_by_json(data):
data = json.loads(data)<EOL>for i in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if i not in data:<EOL><INDENT>raise QueryException("<STR_LIT>" % i)<EOL><DEDENT><DEDENT>tables = data['<STR_LIT>']<EOL>columns = data['<STR_LIT>']<EOL>conditions = data['<STR_LIT>']<EOL>def parse_stmt(s, expr_cls, all_op, multi_items_op):<EOL><INDENT>if len(s) == <NUM_LIT:0>:<EOL><INDENT>return []<EOL><DEDENT>if s[<NUM_LIT:0>] in all_op:<EOL><INDENT>if s[<NUM_LIT:0>] in multi_items_op:<EOL><INDENT>values = []<EOL>for i in s[<NUM_LIT:1>:]:<EOL><INDENT>values.append(parse_stmt(i, expr_cls, all_op, multi_items_op))<EOL><DEDENT>return expr_cls(None, s[<NUM_LIT:0>], None, values=values)<EOL><DEDENT>else:<EOL><INDENT>if len(s) == <NUM_LIT:5>:<EOL><INDENT>lhs = Column(s[<NUM_LIT:2>], table=s[<NUM_LIT:1>])<EOL>rhs = Column(s[<NUM_LIT:4>], table=s[<NUM_LIT:3>])<EOL>if (s[<NUM_LIT:1>] not in tables) or (s[<NUM_LIT:3>] not in tables):<EOL><INDENT>raise QueryException('<STR_LIT>')<EOL><DEDENT>return expr_cls(lhs, s[<NUM_LIT:0>], rhs)<EOL><DEDENT>else:<EOL><INDENT>lhs = Column(s[<NUM_LIT:2>], table=s[<NUM_LIT:1>])<EOL>if s[<NUM_LIT:1>] not in tables:<EOL><INDENT>raise QueryException('<STR_LIT>')<EOL><DEDENT>return expr_cls(lhs, s[<NUM_LIT:0>], s[<NUM_LIT:3>])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise QueryException('<STR_LIT>')<EOL><DEDENT><DEDENT>query_op = ('<STR_LIT:+>', '<STR_LIT:->', '<STR_LIT:*>', '<STR_LIT:/>')<EOL>query_columns = []<EOL>for i in columns:<EOL><INDENT>if len(i) == <NUM_LIT:2>:<EOL><INDENT>query_columns.append(Column(i[<NUM_LIT:1>], table=i[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>query_columns.append(parse_stmt(i, QueryExpression, query_op, query_op))<EOL><DEDENT><DEDENT>wheres = parse_stmt(conditions, ConditionExpression, _operator_map, ('<STR_LIT>', '<STR_LIT>',))<EOL>return {<EOL>'<STR_LIT>': tables,<EOL>'<STR_LIT>': query_columns,<EOL>'<STR_LIT>': wheres,<EOL>}<EOL>
['and',
    ['==', 't1', 'col1', val1],
    ['!=', 't1', 'col2', 't2', 'col2'],
    ['and',
        ['==', 't1', 'col3', val3],
        ['!=', 't2', 'col4', val4],
    ]
]
:return:
:param data: 
:return: