Пример #1
0
    def test_create_index_with_length(self):
        m = MetaData()
        tbl = Table('testtbl', m, Column('data', String(255)))
        idx1 = Index('test_idx1', tbl.c.data, length=10)
        idx2 = Index('test_idx2', tbl.c.data, length=5)

        self.assert_compile(schema.CreateIndex(idx1),
            'CREATE INDEX test_idx1 ON testtbl ([data](10))',
            dialect=cubrid.dialect())
        self.assert_compile(schema.CreateIndex(idx2),
            'CREATE INDEX test_idx2 ON testtbl ([data](5))',
            dialect=cubrid.dialect())
Пример #2
0
    def test_create_index_with_desc(self):
        m = MetaData()
        tbl = Table('testtbl', m, Column('data', String(255)))
        idx1 = Index('test_idx1', tbl.c.data, desc=True)
        idx2 = Index('test_idx2', tbl.c.data, desc=False)

        self.assert_compile(schema.CreateIndex(idx1),
            'CREATE INDEX test_idx1 ON testtbl ([data]) DESC',
            dialect=cubrid.dialect())
        self.assert_compile(schema.CreateIndex(idx2),
            'CREATE INDEX test_idx2 ON testtbl ([data])',
            dialect=cubrid.dialect())
Пример #3
0
    def test_create_pk_plain(self):
        m = MetaData()
        tbl = Table('testtbl', m, Column('pk_data', String(255)),
            PrimaryKeyConstraint('pk_data'))

        self.assert_compile(schema.CreateTable(tbl),
            "CREATE TABLE testtbl (pk_data VARCHAR(255), PRIMARY KEY (pk_data))",
            dialect=cubrid.dialect())
Пример #4
0
    def test_create_index_simple(self):
        m = MetaData()
        tbl = Table('testtbl', m, Column('data', String(255)))
        idx = Index('test_idx1', tbl.c.data)

        self.assert_compile(schema.CreateIndex(idx),
            'CREATE INDEX test_idx1 ON testtbl ([data])',
            dialect=cubrid.dialect())