def query_db(query, args=(), one=False):
 cur = get_db().execute(query, args)
 rv = cur.fetchall()
 return ((rv[0] if rv else None) if one else rv)

def query_db ( query , args = ( ) , one = False ) : cur = get_db ( ) . execute ( query , args ) rv = cur . fetchall ( ) return ( ( rv [ 0 ] if rv else None ) if one else rv )
queries the database and returns a list of dictionaries .