code: def get_field_list(fields, schema):
    
    # If the fields weren't supplied get them from the schema.
    if schema:
      all_fields = [f['name'] for f in schema._bq_schema if f['type'] != 'RECORD']
  
    if isinstance(fields, list):
      if schema:
        # validate fields exist
        for f in fields:
          if f not in all_fields:
            raise Exception('Cannot find field %s in given schema' % f)
      return fields
    if isinstance(fields, basestring) and fields != '*':
      if schema:
        # validate fields exist
        for f in fields.split(','):
          if f not in all_fields:
            raise Exception('Cannot find field %s in given schema' % f)
        return fields.split(',')
    if not schema:
      return []
    return all_fields
docs: Convert a field list spec into a real list of field names.
  
        For tables, we return only the top-level non-RECORD fields as Google charts
        can't handle nested data.