コード例 #1
0
 def define_tables(cls, metadata):
     Table('t', metadata,
        Column('a', Integer),
        Column('b', Integer),
        Column('c', Integer),
        DistributeByConstraint('a', 'b')
     )
コード例 #2
0
    def test_alter_table_distribute_by(self):
        dbc = DistributeByConstraint('a', 'b')
        self.tables.t.append_constraint(dbc)

        config.db.execute(DropConstraint(dbc))

        insp = inspect(testing.db)
        for c in insp.get_columns('t'):
            assert c['is_distribution_key'] == False

        config.db.execute(AddConstraint(dbc))

        insp = inspect(testing.db)
        for c in insp.get_columns('t'):
            if not (c['name'] == 'c'):
                assert c['is_distribution_key'] == True
            else:
                assert c['is_distribution_key'] == False