def _set_index(self, schema, name, fields, **index_options):
index_fields = []<EOL>for field_name in fields:<EOL><INDENT>field = schema.fields[field_name]<EOL>if issubclass(field.type, basestring):<EOL><INDENT>if field.options.get('<STR_LIT>', False):<EOL><INDENT>field_name = '<STR_LIT>'.format(self._normalize_name(field_name))<EOL><DEDENT><DEDENT>index_fields.append(field_name)<EOL><DEDENT>query_str = '<STR_LIT>'.format(<EOL>'<STR_LIT>' if index_options.get('<STR_LIT>', False) else '<STR_LIT>',<EOL>self._normalize_name("<STR_LIT>".format(schema, name)),<EOL>self._normalize_table_name(schema),<EOL>'<STR_LIT:U+002CU+0020>'.join(index_fields)<EOL>)<EOL>return self.query(query_str, ignore_result=True, **index_options)<EOL>
NOTE -- we set the index name using <table_name>_<name> format since indexes have to have
a globally unique name in postgres

http://www.postgresql.org/docs/9.1/static/sql-createindex.html