2012-02-10 2 views
2
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에 "전체 텍스트 색인"을 만드는 방법은 무엇입니까? 당신이 sqlalchemy.schemaIndex에서 코드를 확인할 수있는 경우 (이 아닌 일반 인덱스)SQLAlchemy에서 전체 텍스트 인덱스는 어떻게 지정합니까?

+0

참고 : 실제로 쿼리 API를 사용할 필요는 없습니다. 색인을 정의하고 정의해야합니다. (나는 어쨌든 원시 SQL을 사용하고있다.) – TIMEX

답변

1

는 그들이 단지 unique을 확인 Index__init__ 지금

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 

을 썼다. 나는 당신이 DDL sqlalchemy의 조작 기능을 사용해야 만 전체 텍스트 색인을 생성하는 것 같아요.

+3

DDL 예제 : http://docs.sqlalchemy.org/en/latest/core/schema.html?highlight=ddl#sqlalchemy.schema.DDL – zzzeek

관련 문제