def test_drop_column_error_on_primary_key(self, get_model, index_count):
        get_model.return_value = models.SmallTestModel
        index_count.return_value = 1

        test_update = update.DropColumn(models.SmallTestModel.table, "key")
        with self.assertRaisesRegex(error.SpannerError, "Column key is indexed"):
            test_update.validate()
    def test_drop_column(self, get_model, index_count):
        table_name = models.SmallTestModel.table
        get_model.return_value = models.SmallTestModel
        index_count.return_value = 0

        test_update = update.DropColumn(table_name, "value_2")
        test_update.validate()
        self.assertEqual(
            test_update.ddl(),
            "ALTER TABLE {} DROP COLUMN value_2".format(table_name))