def get_field_setup_query(query, model, column_name):
 if (not hasattr(model, column_name)):
  rel_model = getattr(model, column_name.split('.')[0]).mapper.class_
  query = query.join(rel_model)
  return (query, getattr(rel_model, column_name.split('.')[1]))
 else:
  return (query, getattr(model, column_name))

def get_field_setup_query ( query , model , column_name ) : if ( not hasattr ( model , column_name ) ) : rel_model = getattr ( model , column_name . split ( '.' ) [ 0 ] ) . mapper . class_ query = query . join ( rel_model ) return ( query , getattr ( rel_model , column_name . split ( '.' ) [ 1 ] ) ) else : return ( query , getattr ( model , column_name ) )
help function for sqla filters .