在SQLAlchemy中,如何指定全文索引?

时间:2012-02-10 03:24:30

标签: mysql database indexing sqlalchemy

class AccountIndexes(Base):
    __tablename__ = 'account_indexes'
    id = Column(Integer, primary_key = True)
    user_id = Column(Integer, nullable=False, unique=True, index=True)
    full_name = Column(String(255), nullable=True)
    __table_args__ = {'mysql_engine':'MyISAM'}

那是我的桌子。如何在full_name上创建“全文索引”? (不是正常的指数)

1 个答案:

答案 0 :(得分:1)

如果您可以查看Index的{​​{1}}中的代码,那么他们会写

sqlalchemy.schema

现在位于def __init__(self, name, *columns, **kw): """Construct an index object. :param name: The name of the index :param \*columns: Columns to include in the index. All columns must belong to the same table. :param unique: Defaults to False: create a unique index. :param \**kw: Other keyword arguments may be interpreted by specific dialects. """ self.table = None # will call _set_parent() if table-bound column # objects are present ColumnCollectionMixin.__init__(self, *columns) self.name = name self.unique = kw.pop('unique', False) self.kwargs = kw 的{​​{1}},他们只检查__init__。我认为要生成全文索引,你必须使用sqlalchemy的Index操作功能。