def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
    'Base function for field level analysis\n      expr_func_map: contains mapping for expression to SQL function to all fields\n    '
    if ('.' not in table_name):
        raise Exception("table_name must have schema and name in it with a '.'")
    if (analysis not in self.template_dict['analysis']):
        raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
    (schema, table) = self._split_schema_table(table_name)
    field_rows = self.get_columns(table_name)
    field_type = {r.column_name.lower(): r.type for r in field_rows}
    if (not fields):
        fields = [r.column_name for r in field_rows]
    for expr in list(expr_func_map):
        tmpl_path = ('function.' + expr_func_map[expr])
        expr_func_map[expr] = ',\n'.join([self._template(tmpl_path).format(field=field) for field in [r.column_name for r in field_rows]])
    sep = (' \nunion all\n' if union else ' \n ;\n')
    sql = sep.join([self._template(('analysis.' + analysis)).format(schema=schema, field=field, table=table, type=(field_type[field.lower()] if field else ''), **expr_func_map, **kwargs) for field in fields])
    return (sql if as_sql else self.query(sql, analysis, echo=False))
Base function for field level analysis
expr_func_map: contains mapping for expression to SQL function to all fields
def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
    'Base function for field level analysis\n      expr_func_map: contains mapping for expression to SQL function to all fields\n    '
    if ('.' not in table_name):
        raise Exception("table_name must have schema and name in it with a '.'")
    if (analysis not in self.template_dict['analysis']):
        raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
    (schema, table) = self._split_schema_table(table_name)
    field_rows = self.get_columns(table_name)
    field_type = {r.column_name.lower(): r.type for r in field_rows}
    if (not fields):
        fields = [r.column_name for r in field_rows]
    for expr in list(expr_func_map):
        tmpl_path = ('function.' + expr_func_map[expr])
        expr_func_map[expr] = ',\n'.join([self._template(tmpl_path).format(field=field) for field in [r.column_name for r in field_rows]])
    sep = (' \nunion all\n' if union else ' \n ;\n')
    sql = sep.join([self._template(('analysis.' + analysis)).format(schema=schema, field=field, table=table, type=(field_type[field.lower()] if field else ), **expr_func_map, **kwargs) for field in fields])
    return (sql if as_sql else self.query(sql, analysis, echo=False))